comparison fuzzer-preauth.c @ 1348:5c2899e35b63 fuzz

fuzz harness
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 May 2017 22:50:54 +0800
parents
children 3677a510f545
comparison
equal deleted inserted replaced
1347:b28624698130 1348:5c2899e35b63
1 #include "fuzz.h"
2 #include "dbrandom.h"
3 #include "session.h"
4
5 static int setup_fuzzer(void) {
6 svr_setup_fuzzer();
7 return 0;
8 }
9
10 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
11 static int once = 0;
12 if (!once) {
13 setup_fuzzer();
14 once = 1;
15 }
16
17 fuzz.input.data = (unsigned char*)Data;
18 fuzz.input.size = Size;
19 fuzz.input.len = Size;
20 fuzz.input.pos = 0;
21
22 seedrandom();
23
24 if (setjmp(fuzz.jmp) == 0) {
25 svr_session(-1, -1);
26 } else {
27 // dropbear_exit jumped here
28 }
29
30 return 0;
31 }