Mercurial > dropbear
comparison fuzz-harness.c @ 1563:1cbb7b3d6703
Merge fuzzing branch
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 28 Feb 2018 22:12:05 +0800 |
parents | 92c93b4a3646 |
children | 35af85194268 |
comparison
equal
deleted
inserted
replaced
1560:f5026f7486de | 1563:1cbb7b3d6703 |
---|---|
1 #include "includes.h" | |
2 #include "buffer.h" | |
3 #include "dbutil.h" | |
4 | |
5 extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); | |
6 | |
7 int main(int argc, char ** argv) { | |
8 int i; | |
9 buffer *input = buf_new(100000); | |
10 | |
11 for (i = 1; i < argc; i++) { | |
12 #if DEBUG_TRACE | |
13 if (strcmp(argv[i], "-v") == 0) { | |
14 debug_trace = 1; | |
15 TRACE(("debug printing on")) | |
16 } | |
17 #endif | |
18 } | |
19 | |
20 for (i = 1; i < argc; i++) { | |
21 if (argv[i][0] == '-') { | |
22 /* ignore arguments */ | |
23 continue; | |
24 } | |
25 | |
26 char* fn = argv[i]; | |
27 buf_setlen(input, 0); | |
28 buf_readfile(input, fn); | |
29 buf_setpos(input, 0); | |
30 | |
31 printf("Running %s once \n", fn); | |
32 LLVMFuzzerTestOneInput(input->data, input->len); | |
33 printf("Running %s twice \n", fn); | |
34 LLVMFuzzerTestOneInput(input->data, input->len); | |
35 printf("Done %s\n", fn); | |
36 } | |
37 | |
38 printf("Finished\n"); | |
39 | |
40 return 0; | |
41 } |