Skip to content

Limit TIFF RGBA decoding buffer to image height - #10577

Merged
radarhere merged 2 commits into
mainfrom
tiff-rgba-clamp-rows-per-block
Nov 21, 2026
Merged

radarhere merged 2 commits into
mainfrom
tiff-rgba-clamp-rows-per-block

Conversation

@aclark4life

Copy link
Copy Markdown
Member

When a TIFF is decoded through libtiff's TIFFRGBAImage interface (e.g. non-JPEG YCbCr), _decodeAsRGBA sized its buffer as RowsPerStrip (or TileLength) × width × 4, even when that was larger than the image height. Only the image height worth of rows is ever read, so the rest was unused.

For example, a 1000×1 image with RowsPerStrip of 1,000,000 currently fails with decoder error -9, as the requested buffer exceeds INT_MAX. Smaller values just over-allocate.

This limits the number of rows to the image height. The previous special case for (UINT32)(-1) is covered by the new comparison.

🤖 Generated with Claude Code

When decoding through TIFFRGBAImage, the buffer was sized from
RowsPerStrip or TileLength, even if that exceeded the image height.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@radarhere
radarhere merged commit 389d62a into main Nov 21, 2026
117 of 118 checks passed
@radarhere
radarhere deleted the tiff-rgba-clamp-rows-per-block branch November 21, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants