fuzz: improve fuzzing coverage (#2309)

This commit is contained in:
Ivan Nardi
2024-02-09 19:19:03 +01:00
committed by GitHub
parent f5cec001f3
commit 03ecb026ff
81 changed files with 66 additions and 34 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
*entry = fuzzed_data.ConsumeIntegral<u_int32_t>();
if(ndpi_tfind(entry, &root, __compare) == NULL) {
if(ndpi_tsearch(entry, &root, __compare) == NULL) {
if(ndpi_tsearch(entry, fuzzed_data.ConsumeBool() ? &root : NULL, __compare) == NULL) {
ndpi_free(entry);
} else {
/* Keep one random entry really added */
@@ -65,7 +65,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
for (i = 0; i < num_iteration; i++) {
e = fuzzed_data.ConsumeIntegral<u_int32_t>();
ndpi_tfind(&e, &root, __compare);
ndpi_tfind(&e, fuzzed_data.ConsumeBool() ? &root : NULL, __compare);
}
/* Search of an added node */
if (is_added) {