Mercurial > dropbear
annotate fuzz-harness.c @ 1363:b2f295125ed6 fuzz
-v for debug_trace
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 21 May 2017 18:53:33 +0800 |
parents | 6b89eb92f872 |
children | 9891bc31a1b3 |
rev | line source |
---|---|
1348 | 1 #include "includes.h" |
1354 | 2 #include "buffer.h" |
3 #include "dbutil.h" | |
1348 | 4 |
5 extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); | |
6 | |
7 int main(int argc, char ** argv) { | |
1354 | 8 int i; |
9 buffer *input = buf_new(100000); | |
10 | |
1363 | 11 for (i = 1; i < argc; i++) { |
12 #if DEBUG_TRACE | |
13 if (strcmp(argv[i], "-v") == 0) { | |
14 debug_trace = 1; | |
15 } | |
1357 | 16 #endif |
1363 | 17 } |
1357 | 18 |
1354 | 19 for (i = 1; i < argc; i++) { |
1363 | 20 if (argv[i][0] == '-') { |
21 // ignore arguments | |
22 continue; | |
23 } | |
24 | |
1354 | 25 char* fn = argv[i]; |
26 buf_setlen(input, 0); | |
27 buf_readfile(input, fn); | |
28 buf_setpos(input, 0); | |
29 | |
1358
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
30 printf("Running %s once \n", fn); |
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
31 LLVMFuzzerTestOneInput(input->data, input->len); |
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
32 printf("Running %s twice \n", fn); |
1354 | 33 LLVMFuzzerTestOneInput(input->data, input->len); |
34 printf("Done %s\n", fn); | |
35 } | |
36 | |
37 printf("Finished\n"); | |
38 | |
1348 | 39 return 0; |
40 } |