fuzz: extend fuzzing coverage (#2040)

Some notes:
* libinjection: according to https://github.com/libinjection/libinjection/issues/44,
it seems NULL characters are valid in the input string;
* RTP: `rtp_get_stream_type()` is called only for RTP packets; if you
want to tell RTP from RTCP you should use `is_rtp_or_rtcp()`;
* TLS: unnecessary check; we already make the same check just above, at
the beginning of the `while` loop
This commit is contained in:
Ivan Nardi
2023-07-11 10:12:08 +02:00
committed by GitHub
parent 859d9ea3c3
commit 950f5cc4e3
18 changed files with 208 additions and 55 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if(fuzzed_data.remaining_bytes() > 4) {
std::vector<u_int8_t>data = fuzzed_data.ConsumeBytes<u_int8_t>(4);
ip = data.data();
ip_len = fuzzed_data.ConsumeIntegralInRange(0, 32);
ip_len = fuzzed_data.ConsumeIntegralInRange(0, 33); /* 33 to force error */
ndpi_fill_prefix_v4(&prefix, (struct in_addr *)ip, ip_len, 32);
node = ndpi_patricia_lookup(p, &prefix);
/* Keep one random node really added */
@@ -71,7 +71,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
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);
ip_len = fuzzed_data.ConsumeIntegralInRange(0, 129); /* 129 to force error */
ndpi_fill_prefix_v6(&prefix, (const struct in6_addr *)ip, ip_len, 128);
node = ndpi_patricia_lookup(p, &prefix);
/* Keep one random node really added */