comparison fuzz-harness.c @ 1745:a6824c54962a

Merge fuzz branch
author Matt Johnston <matt@ucc.asn.au>
date Sun, 18 Oct 2020 22:53:44 +0800
parents d1b279aa5ed1
children
comparison
equal deleted inserted replaced
1738:4f13df974cf4 1745:a6824c54962a
7 int main(int argc, char ** argv) { 7 int main(int argc, char ** argv) {
8 int i; 8 int i;
9 buffer *input = buf_new(100000); 9 buffer *input = buf_new(100000);
10 10
11 for (i = 1; i < argc; i++) { 11 for (i = 1; i < argc; i++) {
12 printf("arg %s\n", argv[i]);
13 #if DEBUG_TRACE 12 #if DEBUG_TRACE
14 if (strcmp(argv[i], "-v") == 0) { 13 if (strcmp(argv[i], "-v") == 0) {
15 debug_trace = 1; 14 debug_trace = 1;
16 TRACE(("debug printing on")) 15 TRACE(("debug printing on"))
17 } 16 }
28 char* fn = argv[i]; 27 char* fn = argv[i];
29 buf_setlen(input, 0); 28 buf_setlen(input, 0);
30 buf_readfile(input, fn); 29 buf_readfile(input, fn);
31 buf_setpos(input, 0); 30 buf_setpos(input, 0);
32 31
32 /* Run twice to catch problems with statefulness */
33 fuzz.wrapfds = old_fuzz_wrapfds; 33 fuzz.wrapfds = old_fuzz_wrapfds;
34 printf("Running %s once \n", fn); 34 printf("Running %s once \n", fn);
35 LLVMFuzzerTestOneInput(input->data, input->len); 35 LLVMFuzzerTestOneInput(input->data, input->len);
36 printf("Running %s twice \n", fn); 36 printf("Running %s twice \n", fn);
37 LLVMFuzzerTestOneInput(input->data, input->len); 37 LLVMFuzzerTestOneInput(input->data, input->len);