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