use calculated size for overflow tests

This greatly reduces how much these tests depend on hard-wired knowledge
about the size classes.
This commit is contained in:
Daniel Micay committed 2022-01-03 21:11:31 -05:00
1 parent acda766e2c
commit 13a1f578cb
2 files changed
+4 -2

No files matched your search

@@ -7,7 +7,8 @@ OPTNONE int main(void) {
if (!p) {
return 1;
}
*(p + 256 * 1024 + 7) = 0;
size_t size = malloc_usable_size(p);
*(p + size + 7) = 0;
free(p);
return 0;
}
@@ -7,7 +7,8 @@ OPTNONE int main(void) {
if (!p) {
return 1;
}
*(p + 8 + 7) ^= 1;
size_t size = malloc_usable_size(p);
*(p + size + 7) ^= 1;
free(p);
return 0;
}