Skip to content

Commit

Permalink
Cast int before potentially exceeding INT_MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Sep 23, 2024
1 parent 731bcda commit 0f579c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libImaging/SgiRleDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 * (uint64_t)c->tablen) {

Check warning on line 186 in src/libImaging/SgiRleDecode.c

View workflow job for this annotation

GitHub Actions / ubuntu-latest Python 3.12

comparison of integer expressions of different signedness: ‘long int’ and ‘long unsigned int’ [-Wsign-compare]
state->errcode = IMAGING_CODEC_OVERRUN;
return -1;
}
Expand Down

0 comments on commit 0f579c3

Please sign in to comment.