summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2014-02-04 11:32:05 +0000
committerAlexander Potapenko <glider@google.com>2014-02-04 11:32:05 +0000
commit844a3cf77e1dad0959bdaf5661287bb4dcaf115b (patch)
tree61a5560f345f4caeea8269585c8e103bddd50c9e /compiler-rt/lib/asan/lit_tests
parent2e1634b69fd45801c457a67567ab2c5b5a2b043f (diff)
downloadbcm5719-llvm-844a3cf77e1dad0959bdaf5661287bb4dcaf115b.tar.gz
bcm5719-llvm-844a3cf77e1dad0959bdaf5661287bb4dcaf115b.zip
[ASan] Use replace_str=0 and replace_intrin=0 in printf-{2,4}.c to avoid triggering a buffer overflow in strlen and memcpy.
This change fixes printf-2.c and printf-4.c under OSX. llvm-svn: 200756
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests')
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/printf-2.c8
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/printf-4.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/printf-2.c b/compiler-rt/lib/asan/lit_tests/TestCases/printf-2.c
index 960c81862df..a31d2e56a0d 100644
--- a/compiler-rt/lib/asan/lit_tests/TestCases/printf-2.c
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/printf-2.c
@@ -1,7 +1,9 @@
// RUN: %clang_asan -O2 %s -o %t
-// RUN: ASAN_OPTIONS=check_printf=1 not %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
-// RUN: ASAN_OPTIONS=check_printf=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
-// RUN: %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
+// We need replace_str=0 and replace_intrin=0 to avoid reporting errors in
+// strlen() and memcpy() called by printf().
+// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=1 not %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
+// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
+// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/printf-4.c b/compiler-rt/lib/asan/lit_tests/TestCases/printf-4.c
index 970b7c6f14f..e93c60ca939 100644
--- a/compiler-rt/lib/asan/lit_tests/TestCases/printf-4.c
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/printf-4.c
@@ -1,7 +1,9 @@
// RUN: %clang_asan -O2 %s -o %t
-// RUN: ASAN_OPTIONS=check_printf=1 not %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
-// RUN: ASAN_OPTIONS=check_printf=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
-// RUN: %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
+// We need replace_str=0 and replace_intrin=0 to avoid reporting errors in
+// strlen() and memcpy() called by puts().
+// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=1 not %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
+// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
+// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
#include <stdio.h>
int main() {
OpenPOWER on IntegriCloud