From 03ecb026ff4d0e545cf21d463807b40265441bb3 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:19:03 +0100 Subject: fuzz: improve fuzzing coverage (#2309) --- fuzz/fuzz_alg_crc32_md5.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fuzz/fuzz_alg_crc32_md5.c') diff --git a/fuzz/fuzz_alg_crc32_md5.c b/fuzz/fuzz_alg_crc32_md5.c index 265bc0417..15c817989 100644 --- a/fuzz/fuzz_alg_crc32_md5.c +++ b/fuzz/fuzz_alg_crc32_md5.c @@ -1,7 +1,9 @@ #include "ndpi_api.h" +#include "ndpi_md5.h" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { u_char hash[16]; + ndpi_MD5_CTX ctx; struct ndpi_popcount popcount; char *str; @@ -14,8 +16,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ndpi_crc16_xmodem(data, size); ndpi_crc16_x25(data, size); ndpi_crc32(data, size); + ndpi_md5(data, size, hash); + ndpi_MD5Init(&ctx); + ndpi_MD5Update(&ctx, data, size / 2); + ndpi_MD5Update(&ctx, data + size / 2, size - size / 2); + ndpi_MD5Final(hash, &ctx); + ndpi_murmur_hash((const char *)data, size); ndpi_quick_hash(data, size); -- cgit v1.2.3