about summary refs log tree commit diff homepage
path: root/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/regression/2007-10-11-illegal-access-after-free-and-branch.c')
-rw-r--r--test/regression/2007-10-11-illegal-access-after-free-and-branch.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
new file mode 100644
index 00000000..fbbb99c3
--- /dev/null
+++ b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
@@ -0,0 +1,19 @@
+// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
+// RUN: %klee --optimize %t1.bc
+// RUN: test -f klee-last/test000001.ptr.err
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+int main(int argc, char **argv) {
+  unsigned char *buf = malloc(3);
+  klee_make_symbolic(buf, 3);
+  if (buf[0]>4) klee_silent_exit(0);
+  unsigned char x = buf[1];
+  free(buf);
+  if (x)
+    return buf[2];
+  klee_silent_exit(0);
+  return 0;
+}