mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-04-29 23:49:41 +00:00
fuzz: improvements (#2400)
Create the zip file with all the traces only once. Add a new fuzzer to test "shoco" compression algorithm
This commit is contained in:
parent
905120588b
commit
ef89183469
9 changed files with 62 additions and 34 deletions
|
|
@ -6,6 +6,8 @@
|
|||
#include <assert.h>
|
||||
#include "fuzzer/FuzzedDataProvider.h"
|
||||
|
||||
static struct ndpi_detection_module_struct *ndpi_struct = NULL;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
FuzzedDataProvider fuzzed_data(data, size);
|
||||
u_int16_t i, num_iteration, is_added = 0;
|
||||
|
|
@ -13,13 +15,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
ndpi_domain_classify *d;
|
||||
u_int16_t class_id;
|
||||
std::string value, value_added;
|
||||
struct ndpi_detection_module_struct *ndpi_struct;
|
||||
NDPI_PROTOCOL_BITMASK all;
|
||||
|
||||
ndpi_struct = ndpi_init_detection_module(NULL);
|
||||
NDPI_BITMASK_SET_ALL(all);
|
||||
ndpi_set_protocol_detection_bitmask2(ndpi_struct, &all);
|
||||
|
||||
|
||||
if (ndpi_struct == NULL) {
|
||||
fuzz_init_detection_module(&ndpi_struct, NULL);
|
||||
}
|
||||
|
||||
/* To allow memory allocation failures */
|
||||
fuzz_set_alloc_callbacks_and_seed(size);
|
||||
|
||||
|
|
@ -58,6 +58,5 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
ndpi_domain_classify_size(d);
|
||||
ndpi_domain_classify_free(d);
|
||||
|
||||
ndpi_exit_detection_module(ndpi_struct);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue