diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-12-27 22:14:03 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-12-27 22:14:03 +0000 |
commit | f787cf7ee65018d99a9da6676e76079a97847bf8 (patch) | |
tree | facf178b80023dbfe454ef057d9a4be035cc86f0 /compiler-rt/test/asan/TestCases/printf-m.c | |
parent | deeca6de08ff517ecc4db90598d67e23c930302f (diff) | |
download | bcm5719-llvm-f787cf7ee65018d99a9da6676e76079a97847bf8.tar.gz bcm5719-llvm-f787cf7ee65018d99a9da6676e76079a97847bf8.zip |
[asan] Fix handling of %m in printf interceptor.
llvm-svn: 290632
Diffstat (limited to 'compiler-rt/test/asan/TestCases/printf-m.c')
-rw-r--r-- | compiler-rt/test/asan/TestCases/printf-m.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/printf-m.c b/compiler-rt/test/asan/TestCases/printf-m.c new file mode 100644 index 00000000000..1e5ebd92e3e --- /dev/null +++ b/compiler-rt/test/asan/TestCases/printf-m.c @@ -0,0 +1,14 @@ +// RUN: %clang_asan -O2 %s -o %t && %run %t + +// FIXME: printf is not intercepted on Windows yet. +// XFAIL: win32 + +#include <stdio.h> + +int main() { + char s[5] = {'w', 'o', 'r', 'l', 'd'}; + // Test that %m does not consume an argument. If it does, %s would apply to + // the 5-character buffer, resulting in a stack-buffer-overflow report. + printf("%m %s, %.5s\n", "hello", s); + return 0; +} |