Integration: #2178 document the bound (from #2157)

Co-authored-by: ronibalthazar <61232335+ronibalthazar@users.noreply.github.com>
This commit is contained in:
aiongg
2026-10-21 14:48:45 +00:00
co-authored by ronibalthazar
parent 9bac4fbd88
commit 7f9f97148d
2 changed files with 9 additions and 5 deletions
+6 -3
View File
@@ -29,9 +29,12 @@ later the TIFF/DNG exporters.
The reader never panics on malformed input (proptests feed random and mutated files): offsets are
bounds-checked; out-of-range or unknown-type entries are skipped; IFD loops are detected; IFD count,
nesting depth and entries per IFD are limited; a next-IFD pointer is followed only when every declared entry was
read, with the counts compared as 64-bit numbers (a BigTIFF declaring 4,294,967,297 entries but holding one can't
pass for a whole directory on a 32-bit target); the total bytes of decoded values are capped at
nesting depth and entries per IFD are limited; at most 65,536 directory entry slots
(`ParseOptions::max_entries_total`) are accepted across the main IFD chain and all child IFDs, even when tables
overlap at distinct offsets, and an IFD past that bound ends the chain or is skipped like any other bad IFD after
the first; a next-IFD pointer is followed only when every declared entry was read, with the counts compared as
64-bit numbers (a BigTIFF declaring 4,294,967,297 entries but holding one can't pass for a whole directory on a
32-bit target); the total bytes of decoded values are capped at
`8 × input + 1 MiB` so a file cannot make us allocate far more than its own size.
## Sources
+3 -2
View File
@@ -11,8 +11,9 @@
//! either byte order, classic or BigTIFF.
//!
//! The reader never panics on malformed input: every offset is bounds-checked, IFD loops are
//! detected, nesting depth / IFD count are limited and the total amount of decoded value bytes is
//! capped relative to the input size (so a hostile file cannot make us allocate unboundedly).
//! detected, nesting depth / IFD count are limited, at most 65,536 directory entry slots are read
//! across the main chain and child IFDs, and decoded value bytes are capped relative to the input
//! size (so overlapping tables cannot multiply entry-vector allocations without bound).
//!
//! Sources: TIFF 6.0 specification (Adobe, 1992), TIFF Technical Note / supplements, the BigTIFF
//! design notes (AWare Systems), Adobe DNG specification 1.7 (tag numbers), CIPA DC-008 (Exif 2.32).