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

Do not attempt to read IFD1 if absent #6840

Merged
merged 1 commit into from Dec 29, 2022
Merged

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.

None yet

2 participants