Mercurial > dropbear
annotate fuzzer-preauth.c @ 1369:ddfcadca3c4c fuzz
fuzzer-pubkey
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 23 May 2017 22:43:34 +0800 |
parents | 17104db7928c |
children | d4cc85e6c569 |
rev | line source |
---|---|
1348 | 1 #include "fuzz.h" |
2 #include "session.h" | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
3 #include "fuzz-wrapfd.h" |
1358
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
4 #include "debug.h" |
1348 | 5 |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
6 static void setup_fuzzer(void) { |
1348 | 7 svr_setup_fuzzer(); |
1358
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
8 //debug_trace = 1; |
1348 | 9 } |
10 | |
11 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { | |
12 static int once = 0; | |
13 if (!once) { | |
14 setup_fuzzer(); | |
15 once = 1; | |
16 } | |
17 | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
18 if (fuzzer_set_input(Data, Size) == DROPBEAR_FAILURE) { |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
19 return 0; |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
20 } |
1348 | 21 |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
22 int fakesock = 1; |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
23 wrapfd_add(fakesock, fuzz.input, PLAIN); |
1348 | 24 |
1361
f9f930e1a516
add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
1358
diff
changeset
|
25 m_malloc_set_epoch(1); |
1348 | 26 if (setjmp(fuzz.jmp) == 0) { |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
27 svr_session(fakesock, fakesock); |
1348 | 28 } else { |
1361
f9f930e1a516
add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
1358
diff
changeset
|
29 m_malloc_free_epoch(1); |
1357 | 30 TRACE(("dropbear_exit longjmped")) |
1348 | 31 // dropbear_exit jumped here |
32 } | |
33 | |
34 return 0; | |
35 } |