mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-27 03:27:21 -06:00
* render: don't let a hostile page-tree /Count abort inspection Found by cargo xtask fuzz on Windows (seed 42): a 355-byte PDF whose /Type /Pages node carries /Count 4294967295 aborted pdfcraft-cli check-one with a 48 GiB allocation (4294967295 x 12 bytes) - an abort, which the engine's catch_unwind guard cannot catch. AGENTS.md §4 requires a malformed PDF to produce an actable error, never a crash. The lopdf Structure impl delegated get_pages to lopdf's own page-tree walk, which trusts /Count and pre-allocates by it. The trait's default walk (depth cap, seen-set, checked page numbering) handles the same input fine, so the override is simply dropped and the bounded walk counts the real pages. Comes with a synthetic regression test (/Count 4294967295, one real page); cargo test -p pdfcraft-render, clippy -D warnings, fmt --check and an end-to-end check-one run all pass. * Drop the duplicated use super::* in the structure tests --------- Co-authored-by: pechnikov2026-star <pechnikov2026-star@users.noreply.github.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>