From ffdf7b1ee18e5295fb4c6f67f4ff3c9490a906a5 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 2 Jan 2022 13:39:42 +0100 Subject: [PATCH] Make the testsuite work for read-after-free This commit makes the testsuite fail if the read-after-free tests are failing, instead of simply printing some info. --- test/simple-memory-corruption/read_after_free_large.c | 3 +++ test/simple-memory-corruption/read_after_free_small.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/simple-memory-corruption/read_after_free_large.c b/test/simple-memory-corruption/read_after_free_large.c index b5e611c..0301e14 100644 --- a/test/simple-memory-corruption/read_after_free_large.c +++ b/test/simple-memory-corruption/read_after_free_large.c @@ -13,6 +13,9 @@ OPTNONE int main(void) { free(p); for (size_t i = 0; i < 128 * 1024; i++) { printf("%x\n", p[i]); + if (p[i] != '\0') { + return 1; + } } return 0; } diff --git a/test/simple-memory-corruption/read_after_free_small.c b/test/simple-memory-corruption/read_after_free_small.c index 7d53e5c..9451a01 100644 --- a/test/simple-memory-corruption/read_after_free_small.c +++ b/test/simple-memory-corruption/read_after_free_small.c @@ -13,6 +13,9 @@ OPTNONE int main(void) { free(p); for (size_t i = 0; i < 16; i++) { printf("%x\n", p[i]); + if (p[i] != '\0') { + return 1; + } } return 0; }