about summary refs log tree commit diff homepage
path: root/test/DeterministicAllocation/nullpage-read.c
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2022-10-13 14:25:43 +0100
committerFrank Busse <f.busse@imperial.ac.uk>2023-03-16 11:57:59 +0000
commit7e49c161b76c687f5813e81305ca6697a397478a (patch)
tree2c167026517a90e0632c2e9a352d77e2d592fbc3 /test/DeterministicAllocation/nullpage-read.c
parent9d0e072e3b40b720a26265f0d9b2b99f2d3a954e (diff)
downloadklee-7e49c161b76c687f5813e81305ca6697a397478a.tar.gz
Add some system tests for KDAlloc
Diffstat (limited to 'test/DeterministicAllocation/nullpage-read.c')
-rw-r--r--test/DeterministicAllocation/nullpage-read.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/DeterministicAllocation/nullpage-read.c b/test/DeterministicAllocation/nullpage-read.c
new file mode 100644
index 00000000..15bdfd7d
--- /dev/null
+++ b/test/DeterministicAllocation/nullpage-read.c
@@ -0,0 +1,20 @@
+// RUN: %clang %s -emit-llvm -g -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -kdalloc -kdalloc-quarantine=1 -output-dir=%t.klee-out %t.bc -exit-on-error >%t.output 2>&1
+// RUN: FileCheck %s -input-file=%t.output
+
+#include <stdlib.h>
+#include <string.h>
+
+int main() {
+  struct {
+    int x;
+    int y;
+  } *ptr = NULL;
+
+  // CHECK: null page access
+  int y;
+  memcpy(&y, &ptr->y, sizeof(ptr->y));
+
+  return 0;
+}