Skip to content

[V4] Decode TIFF large strips and backwards directory chains - #3255

Merged
JimBobSquarePants merged 2 commits into
release/4.1.xfrom
fix/tiff-strip-layout-v4
Oct 27, 2026
Merged

JimBobSquarePants merged 2 commits into
release/4.1.xfrom
fix/tiff-strip-layout-v4

Conversation

@JimBobSquarePants

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Backport #3231 to release/4.1.x. Merge #3231 first.

Apply RowsPerStrip defaults to chunky and planar images. Read large uncompressed strips in reusable row buffers. Accept decreasing directory offsets while rejecting circular chains in TIFF and BigTIFF.

Report the root dimensions on allocation failure and dispose failed frames, including failures during ICC conversion. Reject zero RowsPerStrip in every integrity mode. Strict and IgnoreAncillary reject short uncompressed image data. IgnoreImageData retains available samples and clears missing samples without reading beyond StripByteCounts. Correct the source sizes for subsampled YCbCr and the allocation sizes for planar tiles.

Use the reviewed stored inputs and existing decoder, allocator, and comparison APIs. No runtime image builders remain in these tests. Public APIs remain unchanged.

Verification: 775 TIFF and general decoder regression tests passed in Release on .NET 8 and .NET 10. This includes 28 strip-layout cases covering all integrity modes. No existing tolerances or reference images changed.

Refs #3243

jafin and others added 2 commits October 27, 2026 15:10
A missing RowsPerStrip, or one above the image height, is now limited to the height, so planar files without
the entry decode and the strip buffer only holds rows that exist. Uncompressed strips, chunky or planar, that are
larger than the single buffer allocation limit are read one row at a time. The image dimensions are recorded
before the root frame is allocated, so an allocation failure reports the real size, and a frame that fails to
decode is released. Directory chains that go backwards in the file are accepted; only a revisited directory is
reported as circular.
@JimBobSquarePants
JimBobSquarePants marked this pull request as ready for review October 27, 2026 05:53
@JimBobSquarePants
JimBobSquarePants merged commit cf1abbd into release/4.1.x Oct 27, 2026
11 checks passed
@JimBobSquarePants
JimBobSquarePants deleted the fix/tiff-strip-layout-v4 branch October 27, 2026 05:53
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.

TIFF decoder rejects valid files: missing or large RowsPerStrip, strips above the buffer limit, backwards IFD chains, and "0x0" in allocation errors

2 participants