Skip to content

Bound retained TIFF tag data by stream size - #10225

Merged
hugovk merged 2 commits into
python-pillow:mainfrom
hugovk:ghsa-wqgw-9xfh-qf2g
Oct 16, 2026
Merged

hugovk merged 2 commits into
python-pillow:mainfrom
hugovk:ghsa-wqgw-9xfh-qf2g

Conversation

@hugovk

@hugovk hugovk commented Oct 16, 2026

Copy link
Copy Markdown
Member

Stop ImageFileDirectory_v2.load() from reading out-of-line tag data past the size of the underlying stream, which prevents overlapping TIFF and EXIF entries from retaining many copies of the same bytes. Add a regression test that keeps the first aliased tag and warns while skipping the second.

aclark4life and others added 2 commits October 16, 2026 18:56
Stop ImageFileDirectory_v2.load() from reading out-of-line tag data past the size of the underlying stream, which prevents overlapping TIFF and EXIF entries from retaining many copies of the same bytes. Add a regression test that keeps the first aliased tag and warns while skipping the second.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The per-IFD limit could be bypassed with many frames, each with a tag
pointing to the same payload. Walking 30,000 such frames in a 7.5 MB
file read 227 GB. Each frame's limit is now taken from the bytes left
after previous frames, and fixed when the frame is first loaded so that
reloading it gives the same tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hugovk
hugovk merged commit 0a87417 into python-pillow:main Oct 16, 2026
52 checks passed
@hugovk
hugovk deleted the ghsa-wqgw-9xfh-qf2g branch October 16, 2026 17:37
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