[compiler-rt] 5708e7f - [compiler-rt] fix out-of-bounds access in scudo test (#201390)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 11:55:07 PDT 2026


Author: George Burgess IV
Date: 2026-06-03T12:55:02-06:00
New Revision: 5708e7fd9eca368b1b519c13a58360a15a263e4f

URL: https://github.com/llvm/llvm-project/commit/5708e7fd9eca368b1b519c13a58360a15a263e4f
DIFF: https://github.com/llvm/llvm-project/commit/5708e7fd9eca368b1b519c13a58360a15a263e4f.diff

LOG: [compiler-rt] fix out-of-bounds access in scudo test (#201390)

When `I = 0`, we can't do `Array[I-1]`.

Caught by libcxx hardening.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/primary_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
index cd4b0b8df9867..bedca93119ac3 100644
--- a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
@@ -561,7 +561,7 @@ TEST(ScudoPrimaryTest, PushBlocksDifferentGroups) {
   Allocator->pushBlocks(&SizeClassAllocator, ClassId, Array.data(),
                         static_cast<scudo::u32>(Array.size()));
 
-  for (size_t I = 0; I < Array.size(); I++)
+  for (size_t I = 1; I < Array.size(); I++)
     EXPECT_LE(Array[I - 1] & ~Mask, Array[I] & ~Mask)
         << "Array not ordered: index " << I - 1 << " is < index " << I;
 


        


More information about the llvm-commits mailing list