Skip to content

Fix comparison warnings#9541

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:comparison_warning
Apr 6, 2026
Merged

Fix comparison warnings#9541
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:comparison_warning

Conversation

@radarhere
Copy link
Copy Markdown
Member

@radarhere radarhere commented Apr 5, 2026

https://github.com/python-pillow/Pillow/actions/runs/23992626025/job/69982526309#step:5:39215

  src/libImaging/FliDecode.c: In function 'ImagingFliDecode':
  src/libImaging/FliDecode.c:52:29: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'long unsigned int' [-Wsign-compare]
     52 |     if (bytes + (bytes % 2) < framesize) {
        |                             ^
  src/libImaging/FliDecode.c:262:36: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'Py_ssize_t' {aka 'long int'} [-Wsign-compare]
    262 |         if (advance < 0 || advance > bytes) {
        |                                    ^

We know that bytes is positive, thanks to

if (bytes < 4) {
return 0;
}

and
if (bytes < 10) {
state->errcode = IMAGING_CODEC_OVERRUN;
return -1;
}

@radarhere radarhere force-pushed the comparison_warning branch from 1dd6bd7 to b65bc40 Compare April 6, 2026 03:27
@hugovk hugovk merged commit fcf033b into python-pillow:main Apr 6, 2026
54 of 55 checks passed
@radarhere radarhere deleted the comparison_warning branch April 6, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants