Commit Graph

16 Commits

Author SHA1 Message Date
tylerjenningsw 75cc264ccf Lint: clippy's collapsible_match passes on Rust 1.95
cargo +1.95 clippy --workspace --all-targets --release -- -D warnings
stopped on seven `if` blocks that clippy wants folded into their match
arm (psd, text, effects x2, pdf x2, render). Each becomes a match guard.
The behaviour is unchanged: when a guard is false the value falls through
to arms that can't match it and then to `_ => {}`. The one exception is
the PDF PostScript calculator, where a `{` past the nesting limit would
fall through to the operator arm; it keeps its own no-op arm, so it is
still skipped rather than pushed as an operator.
2026-10-10 16:54:16 -04:00
Claude 2013ec318a
Merge pull request #557 from haranishi/fix/pdf-inflate-limit 2026-10-10 12:51:15 +00:00
Ikki Nishihara ff38282674 PDF colour spaces and functions: bound sizes, depth and stacks
A PDF could abort the process through its colour spaces and functions.
An Indexed hival of 10^12 asked an image for a 24 TB palette. A sampled
function's outputs (one per /Range pair) multiplied its table without a
bound, and copies of the table (one per q, one per reference) multiplied
it again. Self-referencing colour spaces and functions overflowed the
stack, a calculator's copy doubled its operand stack, index, idiv and
mod could panic, and f64::clamp panicked on a reversed /Domain or
/Range. Clamp hival to 255, count samples with checked arithmetic (at
most 32 inputs and outputs, 2^24 samples a table), share the samples,
give one function read a budget of nodes and samples, limit nesting to
8 levels and the calculator stack to 100, and clamp with the bounds in
either order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-10 20:29:28 +09:00
Ikki Nishihara 6364ddf555 PDF: bound what every stream filter may decode to
decode_stream_within now bounds the output of each stage of a /Filter
chain, not only FlateDecode. RunLength, LZW, ASCIIHex and ASCII85 stop
when their output would pass the limit, a full LZW table takes no more
entries, PNG predictor rows are sized with checked arithmetic and only
allocated when a whole row fits in the data, and CCITT checks
/Rows x row bytes against the limit before allocating.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-10 18:12:06 +09:00
Ikki Nishihara 8c665a19e2 PDF: bound what a FlateDecode stream may inflate to
inflate used the unbounded miniz_oxide functions, and File::parse decodes
every object stream eagerly. Use the limit variants (1 GiB per stream, 256 MiB
for object streams, a quarter of that on 32-bit targets) and bound the
truncated-stream salvage buffer too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-10 17:29:44 +09:00
Dexter 39e6907b5f G2: improve editing reliability and Windows rendering fidelity 2026-10-06 00:00:31 -05:00
Brandon Thomas e910858445 Never crash: PostScript radix numbers outside 2..=36
In EPS/PostScript, `0#7` asked i64::from_str_radix for radix 0, which panics (found by
fuzzing). Radixes outside 2..=36 are not numbers now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:21:14 -04:00
Brandon Thomas 8e4e29844e Never crash: PDF close-path operators and CFF outlines without a current point
The s, b and b* operators closed the path even when there was no current point, which kurbo
asserts against (a panic in debug builds; found by fuzzing). Close only when a subpath is open.
CFF charstrings that draw before their first rmoveto now start the subpath at the current
point, as Type 1 charstrings already did. Denies the panic lints in the crate (it had no panic
sites).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:15:02 -04:00
Brandon Thomas 5db4bff461 M13.12: docs (pdf README, parity, plug-ins), EPS Type 3 fonts reported
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 09:51:22 -04:00
Brandon Thomas 740faf1c1f M13.12: EPS text (show variants, charpath, stringwidth, embedded Type 1/CFF, fallback fonts)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 09:01:10 -04:00
Brandon Thomas d0df520bc1 M13.12: pdf CCITT G3/G4 images, parser robustness tests and panic fixes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 08:54:05 -04:00
Brandon Thomas 3d536cfe5a M13.12: pdf /W2 and /DW2 vertical metrics, CMap WMode
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 08:48:25 -04:00
Brandon Thomas d15b69c734 M13.12: pdf knockout/isolated transparency groups, group alpha and masks on group results
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 08:46:41 -04:00
Brandon Thomas b0b8d4c01a M13.12: pdf mesh shadings (types 4-7) and function-based shadings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 08:42:49 -04:00
Brandon Thomas 7d944ca494 M13.6: PDF/AI text, images, tiling patterns, blend modes, soft masks, pages; clip groups to masks / Merge Paths
Text with embedded TrueType, CFF (Type1C / CIDFontType0C / OpenType), Type 1 and Type 3 fonts,
standard-14 fallback to the bundled OFL fonts; Flate / DCT / inline / stencil images with SMask,
Indexed and ICC alternates; luminosity / alpha soft masks and the 16 blend modes in the SVG
render tree; tiling patterns; calculator functions; file.import page and Footage::page;
Create Shapes from Vector Layer keeps clips (page clips as layer masks, nested clips as Merge
Paths Intersect).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:49:36 -04:00
Brandon Thomas da0ec526f3 M13.2: PDF / Illustrator (.ai) / EPS vector footage (effectcraft-pdf): continuous rasterisation, layered composition import, Create Shapes from Vector Layer; SVG render tree clip groups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 04:12:21 -04:00