mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
In builds with overflow checks (`cargo run`, `cargo test` and `cargo xtask ci`), PDF export aborted the process when a number it wrote rounded to -2,147,483,648 as an f32. pdf-writer 0.15 writes -2,147,483,648.0 as an integer, and `Limits::register_int` overflows when it takes the absolute value. krilla 0.8.2's `Surface` then fails an assertion in its `Drop` while that panic unwinds. `svg_hostile_markup_never_panics` in `import_fuzz` hit it with type shifted 2,147,483,649 pt down. Paths, gradients, dash offsets, images and artboards that far out hit it too, and so does a group around a stroke wide enough to reach that far. Release builds have no overflow checks. PDF export now leaves out art whose coordinates or transform entries lie beyond 1,000,000,000 in its own space or in the content stream it is drawn into, and glyph lines whose spacing lies beyond 1,000,000,000 thousandths of an em. That covers paths and clipping paths, glyph lines, images, gradients, strokes whose width, caps or miter spikes reach that far, and the art and marks of a page whose artboard lies that far, which is written blank. A dash offset beyond the bound is written as its remainder after whole periods of the pattern. The type's transform is now pushed inside the form that marks a fill or stroke of type to overprint. The exporter checks what that form holds through the type's transform, as it checks the same fill or stroke without overprint.