diff options
author | Matt Johnston <matt@ucc.asn.au> | 2017-05-13 22:50:54 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2017-05-13 22:50:54 +0800 |
commit | fb719e3d0ba3571d3abc5638d1fbbe9e1675d6a7 (patch) | |
tree | 7a72eeedf1e3c89258e1e35057f737f1d0176f9c /fuzzer-preauth.c | |
parent | 9f24cdf74c93aa75416687972e69b5b4c8be2698 (diff) |
fuzz harness
--HG--
branch : fuzz
Diffstat (limited to 'fuzzer-preauth.c')
-rw-r--r-- | fuzzer-preauth.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fuzzer-preauth.c b/fuzzer-preauth.c new file mode 100644 index 0000000..6a40108 --- /dev/null +++ b/fuzzer-preauth.c @@ -0,0 +1,31 @@ +#include "fuzz.h" +#include "dbrandom.h" +#include "session.h" + +static int setup_fuzzer(void) { + svr_setup_fuzzer(); + return 0; +} + +int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + static int once = 0; + if (!once) { + setup_fuzzer(); + once = 1; + } + + fuzz.input.data = (unsigned char*)Data; + fuzz.input.size = Size; + fuzz.input.len = Size; + fuzz.input.pos = 0; + + seedrandom(); + + if (setjmp(fuzz.jmp) == 0) { + svr_session(-1, -1); + } else { + // dropbear_exit jumped here + } + + return 0; +} |