From bde8c3c29b19a658980fc6e365a667ffd04d670d Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 24 Aug 2018 05:09:33 -0400 Subject: [PATCH] add another test for invalid small region frees --- test/simple-memory-corruption/Makefile | 1 + .../invalid_free_small_region_far.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 test/simple-memory-corruption/invalid_free_small_region_far.c diff --git a/test/simple-memory-corruption/Makefile b/test/simple-memory-corruption/Makefile index 62d6653..ea267c1 100644 --- a/test/simple-memory-corruption/Makefile +++ b/test/simple-memory-corruption/Makefile @@ -12,6 +12,7 @@ all: \ invalid_free_protected \ invalid_free_unprotected \ invalid_free_small_region \ + invalid_free_small_region_far \ uninitialized_free \ uninitialized_realloc \ uninitialized_malloc_usable_size \ diff --git a/test/simple-memory-corruption/invalid_free_small_region_far.c b/test/simple-memory-corruption/invalid_free_small_region_far.c new file mode 100644 index 0000000..4a7ed29 --- /dev/null +++ b/test/simple-memory-corruption/invalid_free_small_region_far.c @@ -0,0 +1,12 @@ +#include + +__attribute__((optimize(0))) +int main(void) { + char *p = malloc(16); + if (!p) { + return 1; + } + char *q = p + 1024 * 1024 * 1024; + free(q); + return 0; +}