Mercurial > dropbear
annotate fuzz-harness.c @ 1566:3fc0e9a0978b
add fuzzers to travis
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 01 Mar 2018 22:54:57 +0800 |
parents | 92c93b4a3646 |
children | 35af85194268 |
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; | |
1373
9891bc31a1b3
fuzzers disable logging by default
Matt Johnston <matt@ucc.asn.au>
parents:
1363
diff
changeset
|
15 TRACE(("debug printing on")) |
1363 | 16 } |
1357 | 17 #endif |
1363 | 18 } |
1357 | 19 |
1354 | 20 for (i = 1; i < argc; i++) { |
1363 | 21 if (argv[i][0] == '-') { |
1559
92c93b4a3646
Fix to be able to compile normal(ish) binaries with --enable-fuzz
Matt Johnston <matt@ucc.asn.au>
parents:
1373
diff
changeset
|
22 /* ignore arguments */ |
1363 | 23 continue; |
24 } | |
25 | |
1354 | 26 char* fn = argv[i]; |
27 buf_setlen(input, 0); | |
28 buf_readfile(input, fn); | |
29 buf_setpos(input, 0); | |
30 | |
1358
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
31 printf("Running %s once \n", fn); |
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
32 LLVMFuzzerTestOneInput(input->data, input->len); |
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
33 printf("Running %s twice \n", fn); |
1354 | 34 LLVMFuzzerTestOneInput(input->data, input->len); |
35 printf("Done %s\n", fn); | |
36 } | |
37 | |
38 printf("Finished\n"); | |
39 | |
1348 | 40 return 0; |
41 } |