hardened_malloc/test/simple-memory-corruption/eight_byte_overflow_large.c
Daniel Micay d757835d90 increase size for eight_byte_overflow_large test
This was not working as expected due to CONFIG_EXTENDED_SIZE_CLASSES
resulting in 128k being a slab allocation size class. The addition of
padding for the canary pushes it into the next size class, resulting in
this writing over size class rounding padding rather than this actually
being an overflow as intended.
2020-04-11 15:25:34 -04:00

13 lines
199 B
C

#include <stdlib.h>
__attribute__((optimize(0)))
int main(void) {
char *p = malloc(256 * 1024);
if (!p) {
return 1;
}
*(p + 256 * 1024 + 7) = 0;
free(p);
return 0;
}