mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 02:29:31 -06:00
Both page-label readers decode each range's prefix into a string of its own: render's inspection for its range table, Organize for the ranges it returns. Ranges may share one prefix object, so a small file could ask for a copy per range: within the 200,000-entry tree limit, about 200 MiB of copies of one 1,024-byte prefix. Decoded prefixes now take at most 4 MiB in all (MAX_PREFIX_TOTAL_BYTES, beside MAX_LABEL_TOTAL_BYTES). Past that the tree is refused before any label is made, as the other tree limits refuse it. Tests: 5,000 ranges sharing a 1,000-byte prefix are refused in both readers (relabelling such a tree changes nothing), and exactly 4 MiB of prefixes is still read. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>