Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 1 | // RUN: %clang_dfsan %s -o %t |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 2 | // RUN: not %run %t 2>&1 | FileCheck %s |
| 3 | // RUN: %run %t foo |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 4 | // RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 5 | // RUN: not %run %t 2>&1 | FileCheck %s |
| 6 | // RUN: %run %t foo |
| 7 | |
| 8 | #include <stdio.h> |
| 9 | |
| 10 | int do_nothing(const char *format, ...) { |
| 11 | return 0; |
| 12 | } |
| 13 | |
| 14 | int main(int argc, char **argv) { |
| 15 | int (*fp)(const char *, ...); |
| 16 | |
| 17 | if (argc > 1) |
| 18 | fp = do_nothing; |
| 19 | else |
| 20 | fp = printf; |
| 21 | |
| 22 | // CHECK: FATAL: DataFlowSanitizer: unsupported indirect call to vararg function printf |
| 23 | fp("hello %s\n", "world"); |
| 24 | } |