Cast int before potentially exceeding INT_MAX

This commit is contained in:
Andrew Murray 2024-09-24 07:56:45 +10:00
parent 7e6e08ea6a
commit cc0b6b9de9

View File

@ -183,7 +183,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t
each with 4 bytes per element of tablen each with 4 bytes per element of tablen
Check here before we allocate any memory 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; state->errcode = IMAGING_CODEC_OVERRUN;
return -1; return -1;
} }