From 67408e531f07e101f2d3623f2dbe1b3086a588ec Mon Sep 17 00:00:00 2001 From: "a.burlakov" Date: Wed, 16 Sep 2026 13:43:15 +0300 Subject: [PATCH] Fix: NO_CAST.INTEGER_OVERFLOW Problem: The value of an arithmetic expression 'value << state->bits' is a subject to overflow because its operands are not cast to a larger data type before performing arithmetic Solution: Cast value to unsigned long before the left shift to prevent signed integer overflow during shift evaluation. Signed-off-by: a.burlakov@fobos-nt.ru --- zlib/inflate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zlib/inflate.c b/zlib/inflate.c index 1afe007aa..1836d265f 100644 --- a/zlib/inflate.c +++ b/zlib/inflate.c @@ -229,7 +229,7 @@ int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) } if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; value &= (1L << bits) - 1; - state->hold += value << state->bits; + state->hold += (unsigned long)value << state->bits; state->bits += bits; return Z_OK; }