mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-12-04 19:42:12 -05:00
26e88babe9
The attachment listing preferred /Params /Size (ISO 32000-2 §7.11.4) to the bytes an unfiltered stream holds, so a file declaring 999,999 bytes over 10 was listed as 999,999, and a negative /Size was cast `as usize`. Unfiltered streams are now counted, and a /Size that disagrees is kept as Attachment::declared_size; a filtered stream keeps its declared size, unchecked, since counting it would mean decoding it. An empty /Filter array counts as unfiltered; a /Size that is not a non-negative integer is ignored. doc_info gives declared_size, and the Attachments panel row says "the file says N" beside the counted size. Render tests pin the counted/declared pairs for lying, honest, absent, negative, filtered and empty-filter cases; an automation test checks the same through doc_info. All three fail with the old reading. Co-authored-by: KenM76 <172507185+KenM76@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>