Files
pdfcraft/crates
Grzegorz MartensandClaude Opus 5.5 8bf63c8792 M8: the Type 3 cleanup reads content and glyph programs one operator at a time
The Type 3 cleanup at the end of a redaction (unlink_type3) scans every
page and every form it reaches for the glyphs they show, and reads the
programs of the glyphs it keeps for the resources they use. Both parsed
each stream whole before checking for bytes they couldn't read, outside
the page's allowance and up to 1 GiB a stream. So a form with resources
of its own outside the mark, which no other reader follows, cost about
79 bytes of memory per byte of content: the peak grew by 632 MiB for
8 MiB of `n` operators. On main too, wherever a Type 3 font survives in
a page's or a form's resources.

Both now read with pdfcraft_content::ops, one operator at a time, and
refuse for unreadable bytes once they have read the whole stream, as
before. The scan only reads, and either error refuses the whole
operation, so acting on operators before that check changes nothing.

The memory test gains a case for each:
the_forms_followed_through_resources_are_read_one_operator_at_a_time
fails with either read reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-06 17:47:19 +01:00
..
2026-11-03 09:20:23 -05:00
…