Skip to content

Conversation

@radarhere
Copy link
Member

#6748 added reading of IFD1 in Image.Exif.

However, I didn't consider that zero is a special value for the offset to the next IFD.

https://www.media.mit.edu/pia/Research/deepview/exif.html

If its value is '0x00000000', it means this is the last IFD and there is no linked IFD.

So if that is the case, don't attempt to read IFD1.

This fixes some warnings that are shown at the moment - https://github.com/python-pillow/Pillow/actions/runs/3799772426/jobs/6462615701#step:8:4148

Tests/test_file_tiff.py::TestFileTiff::test_get_child_images[Tests/images/hopper.tif-sizes0]
Tests/test_file_tiff.py::TestFileTiff::test_get_child_images[Tests/images/child_ifd.tiff-sizes1]
Tests/test_file_tiff.py::TestFileTiff::test_get_child_images[Tests/images/child_ifd_jpeg.tiff-sizes2]
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/PIL/TiffImagePlugin.py:852: UserWarning: Truncated File Read
warnings.warn(str(msg))

@hugovk hugovk merged commit 9ae53cf into python-pillow:main Dec 29, 2022
@radarhere radarhere deleted the ifd1 branch December 29, 2022 21:48
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