From aa2b590f31237246c82e6fabc5833477ecde35ef Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 23 Sep 2024 19:56:05 +1000 Subject: [PATCH] Prevent division by zero --- src/libImaging/FliDecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index 6b2518d35ce..1bf00e63ab1 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -224,7 +224,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t byt break; case 16: /* COPY chunk */ - if (INT32_MAX / state->xsize < state->ysize) { + if (INT32_MAX < (long)state->xsize * state->ysize) { /* Integer overflow, bail */ state->errcode = IMAGING_CODEC_OVERRUN; return -1;