fuzz: fix memory allocation failure logic (#1867)

We *do* want to have some allocation errors.
Fix some related bugs
Fix: 29be01ef
This commit is contained in:
Ivan Nardi
2023-01-20 14:27:33 +01:00
committed by GitHub
parent 496b284c98
commit 5e8c1ebbb7
280 changed files with 161 additions and 124 deletions
+2 -5
View File
@@ -29,11 +29,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
29 /* Min real data: ip length + udp length + 1 byte */)
return -1;
#ifdef ENABLE_MEM_ALLOC_FAILURES
set_ndpi_malloc(malloc_wrapper);
set_ndpi_free(free_wrapper);
set_mem_alloc_state(size);
#endif
/* To allow memory allocation failures */
fuzz_set_alloc_callbacks_and_seed(size);
ndpi_info_mod = ndpi_init_detection_module(fuzzed_data.ConsumeIntegral<u_int32_t>());