diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-12-19 15:11:27 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-01-30 08:37:24 -0500 |
commit | b1567cf500044be4d6c97e4ef65345acb4aa70ff (patch) | |
tree | b1f4c05392d00fc5e37b67ca0b67578788d0c447 /src/test/fuzz/fuzz_iptsv2.c | |
parent | 83e9918107dba1b969a226b79e1d37a852339e45 (diff) | |
download | tor-b1567cf500044be4d6c97e4ef65345acb4aa70ff.tar.gz tor-b1567cf500044be4d6c97e4ef65345acb4aa70ff.zip |
Three more fuzzers: consensus, hsdesc, intro points
Diffstat (limited to 'src/test/fuzz/fuzz_iptsv2.c')
-rw-r--r-- | src/test/fuzz/fuzz_iptsv2.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/fuzz/fuzz_iptsv2.c b/src/test/fuzz/fuzz_iptsv2.c new file mode 100644 index 0000000000..341d4880bd --- /dev/null +++ b/src/test/fuzz/fuzz_iptsv2.c @@ -0,0 +1,46 @@ +/* Copyright (c) 2016, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ +#define ROUTERPARSE_PRIVATE +#include "or.h" +#include "routerparse.h" +#include "rendcommon.h" +#include "fuzzing.h" + +static void +mock_dump_desc__nodump(const char *desc, const char *type) +{ + (void)desc; + (void)type; +} + +int +fuzz_init(void) +{ + disable_signature_checking(); + MOCK(dump_desc, mock_dump_desc__nodump); + ed25519_init(); + return 0; +} + +int +fuzz_cleanup(void) +{ + return 0; +} + +int +fuzz_main(const uint8_t *data, size_t sz) +{ + rend_service_descriptor_t *desc = + tor_malloc_zero(sizeof(rend_service_descriptor_t)); + const char *str = (const char*) data; + int r = rend_parse_introduction_points(desc, str, sz); + if (r >= 0) { + log_debug(LD_GENERAL, "Parsing okay: %d", r); + } else { + log_debug(LD_GENERAL, "Parsing failed"); + } + rend_service_descriptor_free(desc); + return 0; +} + |