From 7c6910d9e5d5b08a164a22db5db9969e20cbc232 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Wed, 8 May 2024 11:46:02 +0200 Subject: Fix/improve fuzzing (#2426) --- fuzz/Makefile.am | 1 + fuzz/fuzz_ds_ptree.cpp | 6 ++++++ fuzz/ipv6_addresses.txt | 5 +++++ 3 files changed, 12 insertions(+) create mode 100644 fuzz/ipv6_addresses.txt (limited to 'fuzz') diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am index f59e8f76d..6b2883fd6 100644 --- a/fuzz/Makefile.am +++ b/fuzz/Makefile.am @@ -774,6 +774,7 @@ distdir: -o -name '*.cpp' \ -o -name '*.options' \ -o -name 'ipv4_addresses.txt' \ + -o -name 'ipv6_addresses.txt' \ -o -name 'bd_param.txt' \ -o -name 'splt_param.txt' \ -o -name 'random_list.list' \ diff --git a/fuzz/fuzz_ds_ptree.cpp b/fuzz/fuzz_ds_ptree.cpp index d8a055c3b..6659fccc8 100644 --- a/fuzz/fuzz_ds_ptree.cpp +++ b/fuzz/fuzz_ds_ptree.cpp @@ -49,6 +49,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } } + /* Some higher level functions */ + ndpi_load_ipv4_ptree_file(t, "ipv4_addresses.txt", NDPI_PROTOCOL_TLS); + ndpi_load_ipv4_ptree_file(t, "invalid_filename", NDPI_PROTOCOL_TLS); + ndpi_load_ipv6_ptree_file(t, "ipv6_addresses.txt", NDPI_PROTOCOL_TLS); + ndpi_load_ipv6_ptree_file(t, "invalid_filename", NDPI_PROTOCOL_TLS); + /* Random search */ num_iteration = fuzzed_data.ConsumeIntegral(); for (i = 0; i < num_iteration; i++) { diff --git a/fuzz/ipv6_addresses.txt b/fuzz/ipv6_addresses.txt new file mode 100644 index 000000000..a6db510d7 --- /dev/null +++ b/fuzz/ipv6_addresses.txt @@ -0,0 +1,5 @@ +#Random list of ipv6 addresses + +2001:db8:3333:4444:5555:6666:7777:8888 +2001:a:b:c::/64 +ff06::c3 -- cgit v1.2.3