Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed comparison warning #5184

Closed
wants to merge 1 commit into from
Closed

Conversation

radarhere
Copy link
Member

https://github.com/python-pillow/Pillow/runs/1649086275#step:9:118

src/libImaging/TiffDecode.c:241:22: warning: comparison of integers of different signs: 'int' and 'uint32' (aka 'unsigned int') [-Wsign-compare]
if (state->xsize != img.width || state->ysize != img.height) {
~~~~~~~~~~~~ ^ ~~~~~~~~~
src/libImaging/TiffDecode.c:241:51: warning: comparison of integers of different signs: 'int' and 'uint32' (aka 'unsigned int') [-Wsign-compare]
if (state->xsize != img.width || state->ysize != img.height) {
~~~~~~~~~~~~ ^ ~~~~~~~~~~
src/libImaging/TiffDecode.c:582:41: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
for (tile_y = 0; tile_y < current_tile_length; tile_y++) {
~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
3 warnings generated.

@wiredfool
Copy link
Member

I'm not sure that this is the right approach for a couple of reasons.

  1. We should probably not be using the U/INT32 for these in general, they should really be tsize_t or whatever they are in libtiff, because they change over time. Some of the libtiff items have definitely changed from u/int32 -> u/int64 over the time that I've been digging into valgrind.

  2. If we're casting like that, we need to make sure that we're not going to under/overflow in the cast. Basically, it's silencing the warning, but it doesn't actually change the behavior.

@radarhere
Copy link
Member Author

Thanks.
I've updated to remove the casting change, and kept the second change.

@radarhere radarhere changed the title Fixed comparison warnings Fixed comparison warning Jan 5, 2021
@radarhere
Copy link
Member Author

This looks like it became part of #5364.

@radarhere radarhere closed this Apr 1, 2021
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.

None yet

2 participants