summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-01-23 15:09:38 +0000
committerAlexey Samsonov <samsonov@google.com>2014-01-23 15:09:38 +0000
commit1d028b8a9f9355921ed263b1ea48603e6ad198cb (patch)
tree9864ca244a9b38044e9c22a136174d9daae516b4 /compiler-rt/lib/asan/lit_tests
parent793f1b220270b2309d7523e2a5dc150417567152 (diff)
downloadbcm5719-llvm-1d028b8a9f9355921ed263b1ea48603e6ad198cb.tar.gz
bcm5719-llvm-1d028b8a9f9355921ed263b1ea48603e6ad198cb.zip
[Sanitizer] Fix false positive in snprintf interceptor - take the number of actually written symbols from real snprintf call.
llvm-svn: 199899
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests')
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/printf-1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/printf-1.c b/compiler-rt/lib/asan/lit_tests/TestCases/printf-1.c
index 1da520011ce..20618a25085 100644
--- a/compiler-rt/lib/asan/lit_tests/TestCases/printf-1.c
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/printf-1.c
@@ -9,8 +9,13 @@ int main() {
volatile int x = 12;
volatile float f = 1.239;
volatile char s[] = "34";
- printf("%c %d %.3f %s\n", c, x, f, s);
- return 0;
// Check that printf works fine under Asan.
+ printf("%c %d %.3f %s\n", c, x, f, s);
// CHECK: 0 12 1.239 34
+ // Check that snprintf works fine under Asan.
+ char buf[4];
+ snprintf(buf, 1000, "qwe");
+ printf("%s\n", buf);
+ // CHECK: qwe
+ return 0;
}
OpenPOWER on IntegriCloud