blob: 1c0c4d74677e65d56502a5afd44dec9d6cde265b [file] [log] [blame]
Juraj Vijtiuk260407e2020-03-18 10:32:13 +01001#include <stdio.h>
2#include <stdint.h>
3#include <stdlib.h>
4
Juraj Vijtiukdba28812020-09-24 13:56:18 +02005int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len);
6
Juraj Vijtiuk260407e2020-03-18 10:32:13 +01007#ifdef __AFL_COMPILER
8
9int main(void) {
10 int ret;
11 uint8_t buf[64 * 1024];
12
13#ifdef __AFL_LOOP
14 while (__AFL_LOOP(10000))
15#endif
16 {
17 ret = fread(buf, 1, sizeof(buf), stdin);
18 if (ret < 0) {
19 return 0;
20 }
21
22 LLVMFuzzerTestOneInput(buf, ret);
23
24 }
25
26 return 0;
27}
28
Juraj Vijtiukc496e6f2020-06-30 16:15:01 +020029#else
30int main(void) {
31 int ret;
32 uint8_t buf[64 * 1024];
33
34 ret = fread(buf, 1, sizeof(buf), stdin);
35 if (ret < 0) {
36 return 0;
37 }
38
39 LLVMFuzzerTestOneInput(buf, ret);
40
41 return 0;
42}
Juraj Vijtiuk260407e2020-03-18 10:32:13 +010043#endif /* __AFL_COMPILER */