[compiler-rt] [scudo] Apply filling option when realloc grows a block in-place too (PR #93212)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 23:40:18 PDT 2024
================
@@ -374,7 +384,18 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, PatternOrZeroFill) {
else
ASSERT_TRUE(V == scudo::PatternFillByte || V == 0);
}
+
+ // Fill with a known pattern different from PatternFillByte.
memset(P, 0xaa, Size);
+
+ // Shrink and then grow by one byte, verifying that it gets re-filled in
+ // the process. We assume that changing the size by just 1 is done in
+ // place.
+ ASSERT_EQ(Allocator->reallocate(P, Size - 1), P);
+ ASSERT_EQ(Allocator->reallocate(P, Size), P);
+ EXPECT_EQ((reinterpret_cast<unsigned char *>(P))[Size - 1],
+ scudo::PatternFillByte);
+
----------------
ChiaHungDuan wrote:
If you really want to test this, I would suggest having a dedicated config to ensure that the shrinking and expending use the same block
https://github.com/llvm/llvm-project/pull/93212
More information about the llvm-commits
mailing list