Files
Piohrun d90cee4669 fix(render): read each object stream's index once (vendored hayro-syntax patch 22) (#2427)
* fix(render): read each object stream's index once (vendored hayro-syntax patch 22)

`XRef::get_with` parsed an object stream's whole index of `objnum offset`
pairs again for every object it fetched from that stream, so reading all of a
stream of N objects took N² steps. Firefox keeps every object of a page in one
stream: the pdf.js corpus file bug1978317.pdf (65,542 objects in one stream)
took 37 s to draw and 40 s to extract its text, and was a known timeout in the
robustness baseline.

The parsed index is now kept per stream, beside the decoded stream data it
indexes (`ObjectStreamIndexes`), and never cleared, as that data isn't. A
malformed index is remembered as malformed; `/N` or `/First` that can't be
read (a reference that can't be followed while another stream loads) is not
remembered. An offset past `usize` is malformed instead of wrapping. A poisoned
lock is still used: entries are inserted whole.

Release build, Linux: bug1978317.pdf draws in 0.5 s (was 37 s) and extracts
its text in 1.9 s (was 40 s), and leaves the baseline's known timeouts;
40,000 pages in one stream open in 0.2 s (was 54 s).
`raster::tests::objects_in_one_large_object_stream_are_read_in_linear_time`
times out at 20 s with the fix reverted and passes in 0.2 s with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MoEx9Nj8KC4WKDcf5YaokQ

* test(render): an object stream offset past usize is malformed, not a panic

Review follow-up on #2427. Mutation testing by mtlcl410 found that replacing
patch (22)'s `checked_add` in `read_object_stream_index` with a plain `+`
survived every test, although in a debug build that `+` panics on the very
input it guards against (and wraps in a release build). Their test pins it:
it fails with "attempt to add with overflow" under that mutant and passes on
this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 18:01:35 -04:00

22 lines
721 B
JSON

{
"Brotli-Prototype-FileA.pdf": "open-error",
"REDHAT-1531897-0.pdf": "open-error",
"auth-event-ef-open.pdf": "open-error",
"bug1020226.pdf": "open-error",
"bug1782186.pdf": "open-error",
"encrypted-attachment.pdf": "open-error",
"issue15590.pdf": "open-error",
"issue15893_reduced.pdf": "open-error",
"issue16263.pdf": "timeout",
"issue21579.pdf": "open-error",
"issue3371.pdf": "open-error",
"issue6010_1.pdf": "open-error",
"issue6010_2.pdf": "open-error",
"issue9105_other.pdf": "open-error",
"poppler-742-0-fuzzed.pdf": "open-error",
"poppler-937-0-fuzzed.pdf": "open-error",
"pr6531_1.pdf": "open-error",
"print_protection.pdf": "open-error",
"saslprep-r6.pdf": "open-error"
}