Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #8405. Alternative to #8406
The issue is concerned that at
Pillow/src/libImaging/FliDecode.c
Line 227 in 731bcda
state->xsize
might be zero, and so we might be dividing by zero.However, in the context of our library as a whole, images that say one of their dimensions are zero will be stopped at
Pillow/src/PIL/ImageFile.py
Lines 154 to 156 in 731bcda
Even if you consider just the C decoding process, we have
Pillow/src/decode.c
Lines 189 to 192 in 731bcda
So this is not a scenario that should actually occur. However, in order to allay concerns from a casual observer, it might be worth updating the code. I don't consider changes to address this to be a 'fix', but rather a 'If all else fails' safety net.
#8406 suggests resolving the concern by raising an error from within FliDecode.c. My minor concern with that strategy is that we could make someone reading the code think that
xsize
might be zero there.Instead, I'm going to suggest just removing the division operation altogether.