srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz/fuzz_dns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz_dns.cpp')
-rw-r--r--fuzz/fuzz_dns.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/fuzz/fuzz_dns.cpp b/fuzz/fuzz_dns.cpp
new file mode 100644
index 0000000..136c8f0
--- /dev/null
+++ b/fuzz/fuzz_dns.cpp
@@ -0,0 +1,15 @@
+#include <cstddef>
+#include <cstdint>
+
+#include "wireframe/l7/dns.hpp"
+
+// DNS name decoding (length-prefixed labels, a historically bug-prone
+// area in real-world parsers) is the main risk here - fuzz both the
+// raw parser and the dissector wrapper main.cpp actually calls.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ wireframe::net::parse_dns({data, size});
+
+ wireframe::net::DnsDissector dissector;
+ dissector.summarize({data, size});
+ return 0;
+}