Closed Yay295 closed 1 month ago
is there any valid reason
xsize
orysize
would be 0
No. Images that say one of their dimensions are zero will be stopped at https://github.com/python-pillow/Pillow/blob/731bcda904544d9d26bce268eca3a5cb4fcc1c46/src/PIL/ImageFile.py#L154-L156
Even if you consider just the C decoding process, we have https://github.com/python-pillow/Pillow/blob/731bcda904544d9d26bce268eca3a5cb4fcc1c46/src/decode.c#L189-L192
My minor concern with this strategy is that we could make someone reading the code think that xsize
might be zero, which as I've said, shouldn't happen.
I've created #8408 as an alternative to this.
Fixes #8405
I put the check near the top, but is there any valid reason
xsize
orysize
would be 0, and the check would need to be later in the code?