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.
This commit is contained in:
Ivan Nardi
2023-01-25 11:44:59 +01:00
committed by GitHub
parent 29c5cc39fb
commit 9fc724de5a
184 changed files with 436 additions and 60 deletions
+2 -2
View File
@@ -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);