aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz_ds_tree.cpp
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-02-09 19:19:03 +0100
committerGitHub <noreply@github.com>2024-02-09 19:19:03 +0100
commit03ecb026ff4d0e545cf21d463807b40265441bb3 (patch)
treefee3fca194dc2dd113e3b6dee782cc8b220f77e4 /fuzz/fuzz_ds_tree.cpp
parentf5cec001f38f88cc0cdd8892dc6182dd8d7eafd0 (diff)
fuzz: improve fuzzing coverage (#2309)
Diffstat (limited to 'fuzz/fuzz_ds_tree.cpp')
-rw-r--r--fuzz/fuzz_ds_tree.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/fuzz/fuzz_ds_tree.cpp b/fuzz/fuzz_ds_tree.cpp
index d06b5b19f..5e561e2e6 100644
--- a/fuzz/fuzz_ds_tree.cpp
+++ b/fuzz/fuzz_ds_tree.cpp
@@ -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) {