Commit Graph
3117 Commits
Author SHA1 Message Date
bflatastic 8a73ed9963 Security bounds: fix on landing #3936 (see the PR comment) 2026-10-24 17:19:58 +07:00
Dylan M. TaylorandClaude Opus 5.5 e2a870e602 Security: bounded flattening, plug-in budgets and caches, loaded textures, Revolve paint copies, color book names and ICC names
CodeRabbit findings #4, #34, #46, #51, #77, #101, #170, #171, #188:

- `vectorcraft_geom::flatten`: kurbo's flatten with each curve's tolerance raised so it makes
  at most ~4096 segments (non-finite curves become a line); the canvas outline and
  variable-width strokes use it.
- Plug-ins: a heavy filter's budget is the host's `Limits::heavy_fuel`/`heavy_wall_time_ms`,
  never more; a start function runs on one fuel slice; the effect cache holds at most ~1M
  anchors of inputs and results, and doesn't keep a result past a quarter of that.
- Loaded textures are cached by their PNG (base64 spacing doesn't matter), and live textures
  hold at most 512 MB together.
- Revolve draws the source path when the faces' paint copies would pass 256 MB.
- Color books: names with prefix and suffix take at most 64 MB.
- ICC: localized-name (`mluc`) records over 1 MB together are refused before moxcms copies them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:19:54 +07:00
bflatastic a608838ba2 Security bounds: fix on landing #3939 (see the PR comment) 2026-10-24 17:19:54 +07:00
Dylan M. TaylorandClaude Opus 5.5 b12ee928f3 Security: document model generation budgets for live art, clipping runs, placed documents, graph masks, path reading and native entries
CodeRabbit findings #58, #75, #82, #113, #159, #175, #187:

- Live evaluation (expansion, envelope mapping and everything inside) makes at most 4M
  objects (`MAX_GENERATED`); deep expansion counts what each live object makes, and envelope
  image pieces count before they are cut.
- Clipping runs copy at most 8M clip path elements together; past it runs are plain groups.
- Exports read at most 256 placed documents; the rest show their previews.
- Graph design and marker budgets count opacity-mask art (`Node::count_with_masks`).
- Native files read at most 32M anchors (4M on wasm) of paths; the web build allows 1 GiB of
  entries after the JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:19:16 +07:00
Dylan M. Taylor 50d976e1e6 style: keep paint.rs spot-colour chain under rustfmt's max width (#3940)
* style: wrap long spot-colour fallback chain to satisfy rustfmt

* fix(brush): replace negated partial-ord comparison (clippy 1.99)
2026-10-24 02:03:48 -04:00
Dylan M. Taylor 4c82749b08 Security: Affinity import and brush expansion bounds (#3887)
* Audit: Affinity import (spot colour chain, zero-width records, corner radii)

* Audit: Affinity layer names are cut at 1024 characters

* Audit: brush expansion bounds (masks, library parsing, flattening), pressure profile lookup

* Brush: reach a node's mask through its extras
2026-10-23 22:43:42 -04:00
bflatastic 8dbca35893 macOS pen pressure: a feed written on the UI thread never waits for a touch 2026-10-24 09:26:27 +07:00
bflatastic b1e36d69f3 macOS: a tablet pen's pressure reaches the tools (#852)
An AppKit local event monitor (apps/vectorcraft/src/mac_tablet.rs) reads each mouse and tablet event's pressure and the pen's end before winit's view handles it and writes them into the canvas's StylusFeed. The feed keeps the pressure of each pointer move, and the canvas pairs them with the frame's moves, so a fast stroke keeps its curve and each point its own pressure; mouse event coalescing is off. The eraser end selects the Eraser tool, as on Linux. Ported from PhotoCraft's crates/tablet (pressure and eraser end only).
2026-10-24 09:26:27 +07:00
bflatastic e219543e58 Main's CI: an unnecessary map_or, testkit's Unix-only mut, and a temp-dir probe that tests running alongside removed 2026-10-24 09:26:06 +07:00
BFlat 90c1f8d196 Merge pull request #3927 from storytold/fix/1479-ai-large-images
.ai import: an image too large for the editing data's reader opens the file as its PDF part, not with a blank layer (#1479)
2026-10-24 08:55:42 +07:00
Dylan M. Taylor d1288e3019 Security: text layout, shaping, font name and embedding bounds (#3880)
* Audit: text layout, shaping, fonts and embedding bounds

* Audit: text bitmap chunk walk without overflow

* Test: PNG metadata chunk walk

* Security: keep the word minimum in wrap regions; allow uncompressed iTXt text

A wrap shape can narrow the first baseline of a rectangular region:
place_at_least then relaxed the minimum to 0 (the region still counted as
"all lines equally wide") and picked the narrow span, breaking a word on
that baseline even though a lower one had room for it whole. Treat the
width as constant only when the region has no wrap shapes.

Also, PNG iTXt chunks may be stored uncompressed: only genuinely
compressed text (flag 1, conservatively anything that does not parse)
counts as compressed metadata now.
2026-10-23 21:53:51 -04:00
Dylan M. Taylor dad86afeee Security: private temp paths for the signing certificate and test output; web font licences stay inside the checkout (#3871)
* Audit: private temp paths for the signing certificate and testkit output; confine web font licences to the checkout

* testkit: refuse a pre-made private temp directory this user cannot write to
2026-10-23 21:52:17 -04:00
Dylan M. Taylor 2541fd8efd Audit: Image Trace bounds (mosaic duplicate tiles and short buffers, overflow-safe raster length, grouping and centerline work caps) (#3878) 2026-10-23 21:52:11 -04:00
bflatastic 76c9aa579d .ai import: an image too large for the editing data's reader opens the file as its PDF part, not with a blank layer (#1479) 2026-10-24 08:39:00 +07:00
aiongg 8cc69ed45c CI: one test binary per crate, nextest, line tables only (#3855)
* CI: line tables only for workspace crates, no debug info for dependencies

* CI: one integration-test binary per crate

Each crate's tests/*.rs files become modules of tests/it/main.rs. Files that change
process-wide state (Color Settings, the font database, installed plug-ins, the working
directory), the fuzz sweeps and the test targets the Affinity corpus workflow names stay
their own binaries.

* Docs: name the integration tests' new paths

* CI: xtask test with nextest and doctests, one wasm check, clippy --keep-going

cargo xtask ci runs the tests with cargo nextest (cargo test when it is not installed),
builds them with --lib --bins --tests, runs the doctests as their own step, and checks
the wasm crates in one cargo check --keep-going call.
2026-10-23 21:36:10 -04:00
Angelo BernardiniandClaude Opus 5.5 e11ff0352b G11: Shape Builder pieces: contract the sweep's stubs between two cuts of one path
Where two passes of a path (an open line's way there and back) cross another
path, the sweep can cut them a rounding error apart and join the two cuts
with a stub a little over its tolerance. Upstream's twin-piece joining
already merges the ends of the two passes, but not such stubs, so dense
hatches at exact binary steps (lines every 0.5 pt across a 45° line) still
came back with a speck of a piece per crossing. The planar map now contracts
such stubs into one vertex before the edges are built (within 4x eps up and
down the sweep's frame and 1/16 of the 0.01 pt precision along it), bounded
by each cluster's extent so a run of tiny, nearly level segments (a finely
flattened or traced path) is not collapsed transitively.

Ported from the fork's d5985b14 and 616a5c4a with their tests:
a_dense_hatch_at_exact_binary_steps_cuts_each_line_once_per_crossing (fails
without the fix), a_run_of_tiny_level_segments_is_not_contracted_as_stubs
(fails without the extent bound) and
a_line_crossed_where_its_two_passes_part_is_cut_once (already passing on
upstream, kept as a regression test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014gCpjL3yUhaH3jRp7ksufh
2026-10-24 08:05:47 +07:00
Taha-Mahmoodi 6b52e54a1b Fix #3920: a family another thread is loading is found whole, so fallback text never takes the style of its first file
An installed family was added to the font database one file at a time, so a
lookup on another thread could find it with only some of its styles: text
falling back to Arial took Arial Bold Italic or Bold (its files sort first)
for upright Regular text, and the same text laid out a moment later took
Arial Regular. One Arabic word could even mix the two. Two threads loading
the same family could also add a face twice.

A family's files are now read and parsed first and their faces added under
one lock, skipping faces another thread added meanwhile. Loading a family
reports it loaded when another thread loaded it meanwhile, so the fallback
search doesn't go on to other families.

This made tests_bidi::a_change_of_paint_in_a_mixed_direction_line_moves_no_glyph
fail intermittently when another test loaded Arial at the same time.
2026-10-24 07:44:14 +07:00
Taha-Mahmoodi ea55f89c24 Fix #3586: the PDF pre-open scan reads a file dense with stream keywords in linear time
Each `stream` keyword walked back up to 64 KiB through every dictionary before it, so 1 MiB of `<</A <</B 1>> >>stream` took minutes. A walk back now stops where the previous keyword's walk began, and a stream without a Length shares the search for the next `endstream`.
2026-10-24 07:35:07 +07:00
Jürg Lehni deb517fbbe Type: an SVG glyph's image is an SVG image by its plain href first
The check for images of SVG documents looked at href and xlink:href alike, so an image whose href is a PNG was cut for an SVG xlink:href; it now reads href, else xlink:href, as the importer does (SVG 2).
2026-10-24 07:12:16 +07:00
Taha-Mahmoodi 767f06b20e Fix #3828: New Document › Branding offers Business Card 91 × 55 mm 2026-10-24 07:12:16 +07:00
Jürg Lehni 4d1b4a3392 Type: SVG glyphs leave out images of SVG documents
The importer expanded an image whose data is an SVG document into art; the SVG table asks for it to be ignored, and a glyph draws no documents inside it.
2026-10-24 06:51:20 +07:00
bflatastic 3fd190f747 Tests: native-menu tests count menu reads only in runs no other test disturbed 2026-10-24 06:26:02 +07:00
el-j 71a669635c M2.1: prevent click-through on open path fills and support segment toggle (#3405) 2026-10-24 06:00:23 +07:00
Jürg Lehni caaccaf5be Type: images in SVG glyph documents draw with the glyph
They were left out because glyph art had no document to keep them in; since #3879 they hold their own pixels until a document takes them in.
2026-10-24 06:00:22 +07:00
NetterSilverandClaude Haiku 5.5 156fe87fdd Reject a leading plus sign in page range numbers
Found while testing crates/doc/src/range.rs:12

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 06:00:21 +07:00
bflatastic 3225315ce1 PDF export: warn about tiles only for a pattern swatch that exists 2026-10-24 05:59:04 +07:00
bflatastic a564fe5d8e PDF export: pattern fills are written as tiling patterns (#3849) 2026-10-24 05:59:04 +07:00
bflatastic b2835c4f2b Tests: engine tests that add fonts to the shared font database take one lock 2026-10-24 05:52:15 +07:00
bflatastic 23d8820898 EMF and WMF export: say when type is written as outlines and pattern fills as their tiles (#3850) 2026-10-24 05:35:12 +07:00
bflatastic 5b1528c9b6 Pathfinder Outline: junctions a hair apart are one cut, so no sliver path is left (#3870) 2026-10-24 05:17:06 +07:00
bflatastic 4eec70e5cd Automation roots: rustfmt and clippy (redundant closure) 2026-10-24 05:16:21 +07:00
Dylan M. Taylor 42f8b513a2 Fix clipboard read-policy bypass and lock-held file checks
- copied_file: check the read policy on the real path when it is
  valid UTF-8; skip non-UTF-8 paths while automation roots are
  active instead of checking a lossy name (path traversal via
  symlink, CodeRabbit #3872 thread 1).
- full_bytes_cached: collect matching cache candidates under the
  FULL lock, then run the read checks after releasing it, so
  filesystem walks no longer stall other FULL users (thread 2).
2026-10-24 05:16:20 +07:00
Dylan M. Taylor cd043f650b Tests: the recovery folder needs read access too; the Place queue check runs for any active tool 2026-10-24 05:16:20 +07:00
Dylan M. Taylor c99b77060d Test: the Place queue is checked against the read roots 2026-10-24 05:16:20 +07:00
Dylan M. Taylor e95e8418ed Audit: automation roots follow file.showPackage, the Place queue, headless file methods, clipboard files, placed-document workers and caches, folder searches and the recovery folder 2026-10-24 05:16:20 +07:00
Angelo BernardiniandClaude Opus 5.5 52a43eefdb G12: ruler guides nudged with art keep to the page's axes at a turned Constrain Angle
With objects and ruler guides selected together, object.nudge moved the
guides by the art's delta turned through General > Constrain Angle, so at
90 degrees a Right nudge moved a horizontal guide vertically. The guides
in that edit now move by the page-axis delta, as guides selected alone
already did (CodeRabbit finding on #3745).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014gCpjL3yUhaH3jRp7ksufh
2026-10-24 04:59:57 +07:00
BFlat e0c1548049 Merge pull request #3896 from storytold/fix/3869-svg-type-features
SVG export: type with small capitals, superscript, subscript or tab leaders is written as outlines (#3869)
2026-10-24 04:51:54 +07:00
BFlat 8d87932f48 Merge pull request #3891 from aiongg/eps-read-soon-headroom
EPS tests: budget tests wait 120 s for the program to stop
2026-10-24 04:51:38 +07:00
aiongg 6877d6535f Links: resolve stored paths with craft-docpath's resolve_absolute (#3267)
* Links: use resolve_absolute for stored paths

* CI: release only with git dependencies from storytold

* Release: check git sources from the parsed Cargo.lock and cargo config

The grep let any character stand for the dot in github.com, passed a missing or stale
Cargo.lock, and missed source replacement in .cargo/config.
2026-10-23 17:51:28 -04:00
bflatastic 166afce360 SVG export: type with small capitals, superscript, subscript or tab leaders is written as outlines (#3869) 2026-10-24 04:49:08 +07:00
aiongg 88884bcd01 EPS tests: budget tests wait 120 s for the program to stop
search_in_a_loop_runs_out_of_the_budget searches about 3 GB before the operation budget runs
out: 14 s on a fast desktop, over the 20 s limit on the FreeBSD runner. The 20 s limit stays
for the tests that use it as a speed bound.
2026-10-24 04:49:08 +07:00
Gabriel Luís da Silva 60764fb65b Fix #3724: Window > New Window is greyed out until it opens a window
New Window was enabled in the menus and in the control channel's menu
listing, but choosing it opened nothing and answered with the internal
note "multiple windows land with M11.5". It is now disabled, as Window >
Arrange's unimplemented items already are, and a direct call fails with
a message meant for the user, translated in every catalog.
2026-10-24 04:49:07 +07:00
Jürg Lehni 181aeef44c Renderer: colour caches key colours with Color::key
The freeform and dithered gradient grids and the separated inks each built the same exact colour key by hand; they now take the one Color::key gives.
2026-10-24 04:49:07 +07:00
Dylan M. Taylor 5020dc0585 PDF export: past the retry cap, one last run leaves out every image instead of failing 2026-10-24 04:49:07 +07:00
bflatastic 2e71ab5476 PDF import and export: rustfmt 2026-10-24 04:49:07 +07:00
Dylan M. Taylor 4b8e69981e Audit: PDF import and export bounds 2026-10-24 04:49:07 +07:00
bflatastic 9c8afb09ba Image encoders: rustfmt 2026-10-24 04:49:07 +07:00
Dylan M. Taylor 52ceefe906 Audit: Targa and palette encoders check pixel buffer sizes 2026-10-24 04:49:07 +07:00
Dylan M. Taylor 9843d5f1ab Audit: export names, linked-file ids and MCP prompt arguments in one pass 2026-10-24 04:49:07 +07:00
bflatastic 028cafa52e Scribble: the row loop's stop compares with partial_cmp (also stops on NaN; clippy) 2026-10-24 04:49:07 +07:00