summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-12-21 19:22:26 +0000
committerKostya Serebryany <kcc@google.com>2015-12-21 19:22:26 +0000
commitb716d999dab3879210de6323d1e61c80f778e1d1 (patch)
treead04ae05ba5d19744bdbe9f54d3f1133062b6508 /test/sanitizer_common
parentbcc273f55551aa32f0d91cc1260fd6df858d8b09 (diff)
[asan] fix fopen interceptor to not crash if path is NULL
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/fopen_nullptr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/fopen_nullptr.c b/test/sanitizer_common/TestCases/fopen_nullptr.c
new file mode 100644
index 000000000..960dda334
--- /dev/null
+++ b/test/sanitizer_common/TestCases/fopen_nullptr.c
@@ -0,0 +1,6 @@
+// Check that fopen(NULL, "r") is ok.
+// RUN: %clang -O2 %s -o %t && %run %t
+#include <stdio.h>
+const char *fn = NULL;
+FILE *f;
+int main() { f = fopen(fn, "r"); }