From c7b4256b499e9dd2393c59c6c557a63d652230b9 Mon Sep 17 00:00:00 2001 From: Simon Tietz Date: Thu, 25 Jan 2024 09:51:06 +0100 Subject: [PATCH] use-after-free-test --- tests/practical/use-after-free.c | 7 ------- tests/regression/79-assembly/03-asm-use-after-free.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 tests/practical/use-after-free.c create mode 100644 tests/regression/79-assembly/03-asm-use-after-free.c diff --git a/tests/practical/use-after-free.c b/tests/practical/use-after-free.c deleted file mode 100644 index 77fc912313..0000000000 --- a/tests/practical/use-after-free.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) { - int *x = malloc(16); - free(x); - asm ("nop" : "=x" (*x)); -} diff --git a/tests/regression/79-assembly/03-asm-use-after-free.c b/tests/regression/79-assembly/03-asm-use-after-free.c new file mode 100644 index 0000000000..47d57f92f6 --- /dev/null +++ b/tests/regression/79-assembly/03-asm-use-after-free.c @@ -0,0 +1,11 @@ +//PARAM: --set ana.activated[+] useAfterFree --disable asm_is_nop +#include + +int main(void) { + int *x = malloc(16); + free(x); + // write + asm ("nop" : "=x" (*x)); // WARN + // read + asm ("nop" : : "x" (*x)); // WARN +}