about summary refs log tree commit diff homepage
path: root/test/regression
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2018-10-03 14:19:59 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-10-10 18:58:09 +0100
commit224532d66198c80c89b6017e14de4bbed53e305e (patch)
tree25101661e0c9ef28a6479f3445c639660ca52a33 /test/regression
parent44892ef160e9a6cb471ecbf100d45cfc5e65f8e6 (diff)
downloadklee-224532d66198c80c89b6017e14de4bbed53e305e.tar.gz
fix handling of failing external calls
Currently KLEE only handles the first segfault in external calls
as it doesn't unblock SIGSEGV afterwards. This patch unblocks the
signal and enables handling of multiple failing calls.
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/2018-10-01-double-segfault.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/regression/2018-10-01-double-segfault.c b/test/regression/2018-10-01-double-segfault.c
new file mode 100644
index 00000000..0fa10e8b
--- /dev/null
+++ b/test/regression/2018-10-01-double-segfault.c
@@ -0,0 +1,27 @@
+// REQUIRES: not-asan
+// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -output-dir=%t.klee-out %t.bc 2>&1 | FileCheck %s
+// CHECK: failed external call: strdup
+// CHECK: failed external call: strdup
+
+// objective: check handling of more than one failing external call
+
+
+#include "klee/klee.h"
+
+#include <stdbool.h>
+#include <string.h>
+
+int main(int argc, char * argv[]) {
+  bool b;
+  klee_make_symbolic(&b, sizeof(bool), "b");
+
+  char * s0;
+  if (b) {
+    s0 = strdup((char *) 0xdeadbeef);
+  } else {
+    s0 = strdup((void *) 0xdeafbee5);
+  }
+  (void) s0;
+}