From 9fc724de5a6539b84dfbec5d0d0fff68dc5676de Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:44:59 +0100 Subject: Add some fuzzers to test other data structures. (#1870) Start using a dictionary for fuzzing (see: https://llvm.org/docs/LibFuzzer.html#dictionaries). Remove some dead code. Fuzzing with debug enabled is not usually a great idea (from performance POV). Keep the code since it might be useful while debugging. --- fuzz/fuzz_ds_patricia.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fuzz/fuzz_ds_patricia.cpp') diff --git a/fuzz/fuzz_ds_patricia.cpp b/fuzz/fuzz_ds_patricia.cpp index c514f3b00..4655ee94f 100644 --- a/fuzz/fuzz_ds_patricia.cpp +++ b/fuzz/fuzz_ds_patricia.cpp @@ -128,8 +128,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ndpi_patricia_remove(p, node); } } else { - if(fuzzed_data.remaining_bytes() > 128) { - std::vectordata = fuzzed_data.ConsumeBytes(128); + if(fuzzed_data.remaining_bytes() > 16) { + std::vectordata = fuzzed_data.ConsumeBytes(16); ip = data.data(); ip_len = fuzzed_data.ConsumeIntegralInRange(0, 128); ndpi_fill_prefix_v6(&prefix, (const struct in6_addr *)ip, ip_len, 128); -- cgit v1.2.3