Juraj Vijtiuk | 260407e | 2020-03-18 10:32:13 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdint.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | #ifdef __AFL_COMPILER |
| 6 | |
| 7 | int main(void) { |
| 8 | int ret; |
| 9 | uint8_t buf[64 * 1024]; |
| 10 | |
| 11 | #ifdef __AFL_LOOP |
| 12 | while (__AFL_LOOP(10000)) |
| 13 | #endif |
| 14 | { |
| 15 | ret = fread(buf, 1, sizeof(buf), stdin); |
| 16 | if (ret < 0) { |
| 17 | return 0; |
| 18 | } |
| 19 | |
| 20 | LLVMFuzzerTestOneInput(buf, ret); |
| 21 | |
| 22 | } |
| 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
Juraj Vijtiuk | c496e6f | 2020-06-30 16:15:01 +0200 | [diff] [blame] | 27 | #else |
| 28 | int main(void) { |
| 29 | int ret; |
| 30 | uint8_t buf[64 * 1024]; |
| 31 | |
| 32 | ret = fread(buf, 1, sizeof(buf), stdin); |
| 33 | if (ret < 0) { |
| 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | LLVMFuzzerTestOneInput(buf, ret); |
| 38 | |
| 39 | return 0; |
| 40 | } |
Juraj Vijtiuk | 260407e | 2020-03-18 10:32:13 +0100 | [diff] [blame] | 41 | #endif /* __AFL_COMPILER */ |