aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2022-12-10 09:18:36 +0100
committerGitHub <noreply@github.com>2022-12-10 09:18:36 +0100
commit9f7ef723327647813a369ab55336845cc7c1b0ab (patch)
treeb1da8965d7d295c2fd99fd1df9cec7043272eb31
parent6004e55d7b36322d4f45744ee5fba236b49343a4 (diff)
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
-rw-r--r--fuzz/fuzz_ndpi_reader.c1
1 files changed, 1 insertions, 0 deletions
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 */