summaryrefslogtreecommitdiff
path: root/lib/asan/lit_tests
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-10-16 13:49:01 +0000
committerKostya Serebryany <kcc@google.com>2013-10-16 13:49:01 +0000
commitcca8e781e5353cba810a0ec3a814ddde2c4934e7 (patch)
tree5b61ac26e76c2f3b075453914e832360458e8e1e /lib/asan/lit_tests
parent166d6aac8aeafe0d915b7233ba9e6714fcfa2aae (diff)
downloadcompiler-rt-cca8e781e5353cba810a0ec3a814ddde2c4934e7.tar.gz
compiler-rt-cca8e781e5353cba810a0ec3a814ddde2c4934e7.tar.bz2
compiler-rt-cca8e781e5353cba810a0ec3a814ddde2c4934e7.tar.xz
[asan] introduce run-time flag 'poison_partial'
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/lit_tests')
-rw-r--r--lib/asan/lit_tests/TestCases/poison_partial.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/asan/lit_tests/TestCases/poison_partial.cc b/lib/asan/lit_tests/TestCases/poison_partial.cc
new file mode 100644
index 00000000..f7c48bf5
--- /dev/null
+++ b/lib/asan/lit_tests/TestCases/poison_partial.cc
@@ -0,0 +1,19 @@
+// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: not %t 2>&1 | FileCheck %s
+// RUN: not %t heap 2>&1 | FileCheck %s
+// RUN: ASAN_OPTIONS=poison_partial=0 %t
+// RUN: ASAN_OPTIONS=poison_partial=0 %t heap
+#include <string.h>
+char g[21];
+char *x;
+
+int main(int argc, char **argv) {
+ if (argc >= 2)
+ x = new char[21];
+ else
+ x = &g[0];
+ memset(x, 0, 21);
+ int *y = (int*)x;
+ return y[5];
+}
+// CHECK: 0 bytes to the right