about summary refs log tree commit diff homepage
path: root/test/Feature/OneFreeError.c
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2023-08-18 15:32:52 +0100
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2023-09-11 11:23:24 +0100
commit2e393db175cd55662f369d15905ce4eb44b154a9 (patch)
tree5fce2165c62b9671ef4a7b91bb93a13afa9005cd /test/Feature/OneFreeError.c
parent9912da3912436a71949b1b97d96975bddcb169e3 (diff)
downloadklee-2e393db175cd55662f369d15905ce4eb44b154a9.tar.gz
Changed use-after-free and double-free tests to expect KDAlloc, plus some small improvements.
Diffstat (limited to 'test/Feature/OneFreeError.c')
-rw-r--r--test/Feature/OneFreeError.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c
index 7eed722a..aa403717 100644
--- a/test/Feature/OneFreeError.c
+++ b/test/Feature/OneFreeError.c
@@ -1,12 +1,14 @@
 // RUN: %clang %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: %klee --output-dir=%t.klee-out --kdalloc %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ptr.err
 
+#include <stdlib.h>
+
 int main() {
-  int *x = malloc(4);
+  int *x = malloc(sizeof(*x));
   free(x);
-  // CHECK: OneFreeError.c:[[@LINE+1]]: memory error: out of bound pointer
+  // CHECK: OneFreeError.c:[[@LINE+1]]: memory error: use after free
   x[0] = 1;
   return 0;
 }