Open radarhere opened 2 weeks ago
Resolves #8530
xsize = int(self.tag_v2.get(IMAGEWIDTH)) ysize = int(self.tag_v2.get(IMAGELENGTH))
to https://github.com/python-pillow/Pillow/blob/82199efbf77f369ad9b7c2c3759e08f517d9925b/src/PIL/TiffImagePlugin.py#L1436-L1440
This change seems reasonable, especially when you consider #4103.
However, if IMAGEWIDTH or IMAGELENGTH were missing, then int(None) previously raised a TypeError. TypeErrors are caught when opening images https://github.com/python-pillow/Pillow/blob/82199efbf77f369ad9b7c2c3759e08f517d9925b/src/PIL/Image.py#L3497-L3506 but the ValueErrors are not.
int(None)
So this change inadvertently broke feeding a TIFF image to ImageFile.Parser, which relies on OSError (which UnidentifiedImageErrors are) to know that there isn't enough data yet.
ImageFile.Parser
https://github.com/python-pillow/Pillow/blob/82199efbf77f369ad9b7c2c3759e08f517d9925b/src/PIL/ImageFile.py#L468-L473
This PR changes the code to raise a TypeError again.
Resolves #8530
8319 changed
to https://github.com/python-pillow/Pillow/blob/82199efbf77f369ad9b7c2c3759e08f517d9925b/src/PIL/TiffImagePlugin.py#L1436-L1440
This change seems reasonable, especially when you consider #4103.
However, if IMAGEWIDTH or IMAGELENGTH were missing, then
int(None)
previously raised a TypeError. TypeErrors are caught when opening images https://github.com/python-pillow/Pillow/blob/82199efbf77f369ad9b7c2c3759e08f517d9925b/src/PIL/Image.py#L3497-L3506 but the ValueErrors are not.So this change inadvertently broke feeding a TIFF image to
ImageFile.Parser
, which relies on OSError (which UnidentifiedImageErrors are) to know that there isn't enough data yet.https://github.com/python-pillow/Pillow/blob/82199efbf77f369ad9b7c2c3759e08f517d9925b/src/PIL/ImageFile.py#L468-L473
This PR changes the code to raise a TypeError again.