fuzz: add a new fuzzer testing memory allocation failures (#1818)
Try to fuzz error paths triggered by allocation errors. Fix some errors already found by this new fuzzer. Basic idea taken from: https://github.com/harfbuzz/harfbuzz/pull/2566/files `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is a standard define used to (not)compile specific code in fuzzing builds. See: https://llvm.org/docs/LibFuzzer.html
This commit is contained in:
Vendored
+5
@@ -161,6 +161,11 @@ cache_result cache_add(cache_t cache, void *item, uint32_t item_size) {
|
||||
|
||||
|
||||
entry->item = ndpi_malloc(item_size);
|
||||
if(!entry->item) {
|
||||
ndpi_free(entry);
|
||||
ndpi_free(map_entry);
|
||||
return CACHE_MALLOC_ERROR;
|
||||
}
|
||||
memcpy(entry->item, item, item_size);
|
||||
entry->item_size = item_size;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user