1 | // RUN: %clang_dfsan %s -o %t |
2 | // RUN: not %run %t 2>&1 | FileCheck %s |
3 | // RUN: %run %t foo |
4 | // RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t |
5 | // RUN: not %run %t 2>&1 | FileCheck %s |
6 | // RUN: %run %t foo |
7 | // |
8 | // REQUIRES: x86_64-target-arch |
9 | |
10 | #include <stdio.h> |
11 | |
12 | int do_nothing(const char *format, ...) { |
13 | return 0; |
14 | } |
15 | |
16 | int main(int argc, char **argv) { |
17 | int (*fp)(const char *, ...); |
18 | |
19 | if (argc > 1) |
20 | fp = do_nothing; |
21 | else |
22 | fp = printf; |
23 | |
24 | // CHECK: FATAL: DataFlowSanitizer: unsupported indirect call to vararg function printf |
25 | fp("hello %s\n" , "world" ); |
26 | } |
27 | |