From f5c2f9280cbf06b716a5849cc4f9005a37c49f19 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Thu, 19 Jan 2023 14:13:17 +0100 Subject: Fix undefined-behaviour in ahocorasick callback (#1864) ``` ndpi_main.c:2119:28: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' ``` Found by oss-fuzz See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55226 --- src/lib/ndpi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 21ec14de3..13a800183 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -2116,7 +2116,7 @@ int ac_domain_match_handler(AC_MATCH_t *m, AC_TEXT_t *txt, AC_REP_t *match) { * the length of the pattern is longer than that of the previous one. * Skip shorter (less precise) templates. */ - if(!(m->match_map & (1 << i))) + if(!(m->match_map & (1u << i))) continue; start = end - pattern->length; -- cgit v1.2.3