diff --git a/test/simple-memory-corruption/Makefile b/test/simple-memory-corruption/Makefile index e3cf7e1..d3e35d7 100644 --- a/test/simple-memory-corruption/Makefile +++ b/test/simple-memory-corruption/Makefile @@ -18,6 +18,8 @@ EXECUTABLES := \ uninitialized_free \ uninitialized_realloc \ uninitialized_malloc_usable_size \ + eight_byte_overflow_small \ + eight_byte_overflow_large \ all: $(EXECUTABLES) diff --git a/test/simple-memory-corruption/eight_byte_overflow_large.c b/test/simple-memory-corruption/eight_byte_overflow_large.c new file mode 100644 index 0000000..f7253d6 --- /dev/null +++ b/test/simple-memory-corruption/eight_byte_overflow_large.c @@ -0,0 +1,12 @@ +#include + +__attribute__((optimize(0))) +int main(void) { + char *p = malloc(128 * 1024); + if (!p) { + return 1; + } + *(p + 128 * 1024 + 7) = 0; + free(p); + return 0; +} diff --git a/test/simple-memory-corruption/eight_byte_overflow_small.c b/test/simple-memory-corruption/eight_byte_overflow_small.c new file mode 100644 index 0000000..6270ac3 --- /dev/null +++ b/test/simple-memory-corruption/eight_byte_overflow_small.c @@ -0,0 +1,12 @@ +#include + +__attribute__((optimize(0))) +int main(void) { + char *p = malloc(8); + if (!p) { + return 1; + } + *(p + 8 + 7) = 0; + free(p); + return 0; +}