Files
pdfcraft/crates
mtlcl410andClaude Opus 4.8 8a6aff26e0 fix(xfa): bound the text the draw phase lays out, so large text in many instances stops
draw_value_text re-measures overflowing text up to six times to shrink it, and
a repeating subform draws its text once per instance, with no shared cache. A
small file with large text drawn across many instances therefore cost one full
text layout per instance per pass, for seconds of work, and finished with a
valid layout, so neither the page limit nor the measurement budget stopped it.

Each pass over a draw's text now counts its characters against a new draw budget
(MAX_DRAW_CHARS), the way the measurement budget bounds container sizing. A real
form's draws stay far below it; a template that lays out far more text stops with
TooLarge. The budget is reduced under test so the guard is exercised without
laying out hundreds of megabytes.

Test: large_text_drawn_in_many_instances_spends_the_draw_budget (fifty instances
of a 20,000-character draw give TooLarge; one copy lays out); it fails without
the cap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-03 10:00:54 +08:00
..
…
…
…
…
…