[compiler-rt] r200756 - [ASan] Use replace_str=0 and replace_intrin=0 in printf-{2, 4}.c to avoid triggering a buffer overflow in strlen and memcpy.

Alexander Potapenko glider at google.com
Tue Feb 4 03:32:05 PST 2014


Author: glider
Date: Tue Feb  4 05:32:05 2014
New Revision: 200756

URL: http://llvm.org/viewvc/llvm-project?rev=200756&view=rev
Log:
[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.


Modified:
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-2.c
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-4.c

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-2.c?rev=200756&r1=200755&r2=200756&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-2.c (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-2.c Tue Feb  4 05:32:05 2014
@@ -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>

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-4.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-4.c?rev=200756&r1=200755&r2=200756&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-4.c (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-4.c Tue Feb  4 05:32:05 2014
@@ -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() {





More information about the llvm-commits mailing list