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:
@@ -224,8 +224,10 @@ int ndpi_init_serializer_ll(ndpi_serializer *_serializer,
|
||||
/* nothing to do */
|
||||
|
||||
} else if (fmt == ndpi_serialization_format_csv) {
|
||||
if (ndpi_init_serializer_buffer(&serializer->header, NDPI_SERIALIZER_DEFAULT_HEADER_SIZE) != 0)
|
||||
if (ndpi_init_serializer_buffer(&serializer->header, NDPI_SERIALIZER_DEFAULT_HEADER_SIZE) != 0) {
|
||||
ndpi_term_serializer(_serializer);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
} else /* ndpi_serialization_format_tlv */ {
|
||||
serializer->buffer.data[0] = 1; /* version */
|
||||
|
||||
Reference in New Issue
Block a user