diff options
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; +} |