From cc0b6b9de94e7c632efb0a10cf985dd7aab74e2a Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 24 Sep 2024 07:56:45 +1000 Subject: [PATCH] Cast int before potentially exceeding INT_MAX --- src/libImaging/SgiRleDecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libImaging/SgiRleDecode.c b/src/libImaging/SgiRleDecode.c index a8db11740..a4ee2e10d 100644 --- a/src/libImaging/SgiRleDecode.c +++ b/src/libImaging/SgiRleDecode.c @@ -183,7 +183,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t each with 4 bytes per element of tablen Check here before we allocate any memory */ - if (c->bufsize < 8 * c->tablen) { + if (c->bufsize < 8 * (int64_t)c->tablen) { state->errcode = IMAGING_CODEC_OVERRUN; return -1; }