aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/fuzz_descriptor.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-13 19:15:26 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-19 15:34:55 -0500
commitb96c70d668f96550401057834bb9caafb5d0e412 (patch)
tree28ebfdf7347eebf92e9b3716baca1d10fcbd3b9a /src/test/fuzz/fuzz_descriptor.c
parentfca91a7793f24fc5f2d043167317fd47dd58f1ed (diff)
downloadtor-b96c70d668f96550401057834bb9caafb5d0e412.tar.gz
tor-b96c70d668f96550401057834bb9caafb5d0e412.zip
Fuzzing: Add an initial fuzzing tool, for descriptors.
This will need some refactoring and mocking.
Diffstat (limited to 'src/test/fuzz/fuzz_descriptor.c')
-rw-r--r--src/test/fuzz/fuzz_descriptor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/fuzz/fuzz_descriptor.c b/src/test/fuzz/fuzz_descriptor.c
new file mode 100644
index 0000000000..1364bf4291
--- /dev/null
+++ b/src/test/fuzz/fuzz_descriptor.c
@@ -0,0 +1,26 @@
+
+#include "or.h"
+#include "routerparse.h"
+#include "routerlist.h"
+#include "fuzzing.h"
+
+int
+fuzz_init(void)
+{
+ ed25519_init();
+ return 0;
+}
+
+int
+fuzz_main(const uint8_t *data, size_t sz)
+{
+ routerinfo_t *ri;
+ const char *str = (const char*) data;
+ ri = router_parse_entry_from_string((const char *)str,
+ str+sz,
+ 0, 0, 0, NULL);
+ if (ri)
+ routerinfo_free(ri);
+ return 0;
+}
+