From 9f7ef723327647813a369ab55336845cc7c1b0ab Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Sat, 10 Dec 2022 09:18:36 +0100 Subject: fuzz: fix signed-integer-overflow (#1822) ``` fuzz_ndpi_reader.c:33:29: runtime error: signed integer overflow: 214013 * 24360337 cannot be represented in type 'int' #0 0x4c1cf7 in fastrand ndpi/fuzz/fuzz_ndpi_reader.c:33:29 #1 0x4c1cf7 in malloc_wrapper ndpi/fuzz/fuzz_ndpi_reader.c:38:11 #2 0x523057 in ndpi_malloc ndpi/src/lib/ndpi_main.c:220:25 ``` Found by oss-fuzz See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54112 --- fuzz/fuzz_ndpi_reader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fuzz/fuzz_ndpi_reader.c b/fuzz/fuzz_ndpi_reader.c index 76f2d7263..e0032340f 100644 --- a/fuzz/fuzz_ndpi_reader.c +++ b/fuzz/fuzz_ndpi_reader.c @@ -27,6 +27,7 @@ struct ndpi_bin malloc_bins; /* unused */ static int mem_alloc_state = 0; +__attribute__((no_sanitize("integer"))) static int fastrand () { if(!mem_alloc_state) return 1; /* No failures */ -- cgit v1.2.3