[compiler-rt] [scudo] Apply filling option when realloc grows a block in-place too (PR #93212)
Fabio D'Urso via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 09:12:44 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);
+
----------------
fabio-d wrote:
Thanks! I've modified the test accordingly, LMK
https://github.com/llvm/llvm-project/pull/93212
More information about the llvm-commits
mailing list