-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[scudo] Apply filling option when realloc grows a block in-place too #93212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,7 +347,17 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, ZeroFill) { | |
| EXPECT_NE(P, nullptr); | ||
| for (scudo::uptr I = 0; I < Size; I++) | ||
| ASSERT_EQ((reinterpret_cast<char *>(P))[I], '\0'); | ||
|
|
||
| // Fill with a non-zero pattern. | ||
| 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], '\0'); | ||
|
|
||
| Allocator->deallocate(P, Origin, Size); | ||
| } | ||
| } | ||
|
|
@@ -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); | ||
|
|
||
|
||
| Allocator->deallocate(P, Origin, Size); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.