diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2023-01-25 11:44:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 11:44:59 +0100 |
commit | 9fc724de5a6539b84dfbec5d0d0fff68dc5676de (patch) | |
tree | d9f72cc9fe448a2ce36bed4aed65a3df93821d43 /fuzz/fuzz_ds_patricia.cpp | |
parent | 29c5cc39fb7f714897c3d6a3454e696e263fb9bc (diff) |
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.
Diffstat (limited to 'fuzz/fuzz_ds_patricia.cpp')
-rw-r--r-- | fuzz/fuzz_ds_patricia.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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::vector<u_int8_t>data = fuzzed_data.ConsumeBytes<u_int8_t>(128); + if(fuzzed_data.remaining_bytes() > 16) { + std::vector<u_int8_t>data = fuzzed_data.ConsumeBytes<u_int8_t>(16); ip = data.data(); ip_len = fuzzed_data.ConsumeIntegralInRange(0, 128); ndpi_fill_prefix_v6(&prefix, (const struct in6_addr *)ip, ip_len, 128); |