diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2014-11-05 17:21:11 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2014-11-05 17:21:11 +0000 |
commit | a1563df4f75e0e46133d607c2665314bbea30aa9 (patch) | |
tree | b0c45fd8fc2dea9101a9a4c154e2d49874d0a1fd /test/dfsan | |
parent | 5749432cc5fe4a9ce89d4fce4987e10f26172dfb (diff) | |
download | compiler-rt-a1563df4f75e0e46133d607c2665314bbea30aa9.tar.gz |
[dfsan] Add runtime function for aborting on indirect calls to
uninstrumented vararg functions.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/dfsan')
-rw-r--r-- | test/dfsan/vararg.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/dfsan/vararg.c b/test/dfsan/vararg.c new file mode 100644 index 000000000..2227ba715 --- /dev/null +++ b/test/dfsan/vararg.c @@ -0,0 +1,24 @@ +// RUN: %clang_dfsan -m64 %s -o %t +// RUN: not %run %t 2>&1 | FileCheck %s +// RUN: %run %t foo +// RUN: %clang_dfsan -mllvm -dfsan-args-abi -m64 %s -o %t +// RUN: not %run %t 2>&1 | FileCheck %s +// RUN: %run %t foo + +#include <stdio.h> + +int do_nothing(const char *format, ...) { + return 0; +} + +int main(int argc, char **argv) { + int (*fp)(const char *, ...); + + if (argc > 1) + fp = do_nothing; + else + fp = printf; + + // CHECK: FATAL: DataFlowSanitizer: unsupported indirect call to vararg function printf + fp("hello %s\n", "world"); +} |