Commit Graph
11425 Commits
Author SHA1 Message Date
Dylan M. Taylor 93e605a2e9 security(ipp): total reply deadline; resumable chunk walk 2026-10-23 14:41:49 -04:00
Dylan M. Taylor 3729c3f664 security(raster,doc): count tile grids without walking them; share rebuilt tiles; index slice merges
Rect::tile_count counts a rect's tiles in u64; try_take_tiles uses it (no usize overflow on 32-bit). Surface::translated reuses one rebuilt tile for equal source-tile windows. auto_slices merges vertically adjacent runs through a hash index instead of searching the output.
2026-10-23 14:41:44 -04:00
Dylan M. Taylor 6da36b61f3 release: the git-sources gate moves into craft-common-actions (storytold/craft-common-actions#78) (#8952)
The check is shared at release.yml@main now; keep only the reusable call.
2026-10-23 14:41:09 -04:00
aiongg 9acf9a0cf9 CI: the Linux gate runs through the suite's shared gate workflow 2026-10-23 18:32:21 +00:00
Dylan M. Taylor b11ecc6ebf security(affinity): charge shared-object expansion against document-wide budgets (#8938)
Reject zero-width fixed-record arrays, borrow pixel state arrays instead of
collecting them per occurrence, charge FiEf slots, curve records and layer
name bytes across the document, bound mixed-text expansion before appending,
and cap distinct allocation-table ids (deletion records now hold no Entry).
2026-10-23 14:30:21 -04:00
Dylan M. Taylor c9892c8f8d security(codecs): refuse implausibly short truncated JPEG scans; charge WebP frame ICC copies
A truncated JPEG scan under a large declared frame was filled out by the
backend to the full admitted size; reject it when the file cannot plausibly
account for the pixels. Animated WebP frames each keep a copy of the ICC
profile, so the aggregate admission now counts it.
2026-10-23 14:12:04 -04:00
aiongg cf0960b520 Merge pull request #8915 from aiongg/ci-speed-2
CI: no debug info for dependencies, nextest in xtask ci, long sweeps spread over days
2026-10-23 13:48:36 -04:00
Hartmut NörenbergandClaude Opus 5.5 f6f0d1d50c fix(ui): the brush resize HUD previews the engine's soft falloff (#8930)
The Ctrl+Alt / Alt+right-drag disc showed the hardness as a solid core to
`hardness × radius` and a linear fade to clear at the radius, not the brush
engine's round tip (a core, then a Gaussian shoulder). A soft tip, which
paints up to ~1.73 × its radius, faded out at the circle.

`tip_preview` now builds its rings from `photocraft_paint::tip_shape`,
`tip_falloff` and `tip_reach` in document pixels at the view's zoom: solid
to the core, the engine's falloff out to its reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:41:27 +02:00
aiongg 9f0f7bc604 Merge pull request #8032 from aiongg/stored-path-resolve
Linked files: resolve stored paths with craft-docpath's resolve_absolute
2026-10-23 13:38:16 -04:00
Finn NewickandClaude Opus 5.5 603c5ac5b0 feat(algo): describe the Gaussian blur as data for other devices
Separable (an exact kernel, or box widths) is the blur Gaussian Blur
runs, taken from blur.rs's own functions; the CPU Gaussian is now built
from it, so a GPU operator running the same description can't drift.
OperatorRegion says which source pixels an output area reads, and
edge_extent is the edge-repeat extent the engine already used for layer
filters (now shared). Tests pin the reach to the CPU's real output and
check an output depends only on its input region.

Part of #5772 (Phase 1, step 1.1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:24:15 +01:00
Hartmut NörenbergandClaude Opus 5.5 c558de747a fix(ui): a scaled-down Clone Source keeps its overlay within the sampling budget
Review follow-up (#8912): a Clone Source scaled below 100 % reads a larger
source area than the overlay covers, so a large brush's overlay overflowed
`clone_preview_periodic`'s 1024 px and vanished. The coverage window now
shrinks around the pointer until both its area and `Mapping::source_rect`
of it fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:16:32 +02:00
Hartmut NörenbergandClaude Opus 5.5 e9d00facd9 fix(ui): Remove Tool trail tints all a stroke removes; brush trails follow hardness (#8916)
The Remove Tool's tint (while dragging, and for waiting strokes) was a hard
capsule at the brush's nominal radius, but the removal takes every pixel the
stroke's dabs touch (`remove::hole`: coverage > 0). A soft tip reaches about
1.73 × its radius, so an 80 px soft brush tinted 80 px and removed ~140 px.
The Mixer Brush, and tools whose live stroke didn't start, showed the same
hard capsule.

- `Trail::feed_reach` / `feed_stroke_reach`: the stroke's dabs (the brush
  engine, as `feed_dabs`) where they reach at all, in full. Waiting strokes
  keep the earlier ones' tint under them (`base`).
- Remove uses them; the Mixer Brush and the fallback trail use `feed_dabs`
  (soft); Quick Selection keeps its capsule (`select.quick` reads the size).
- `Trail::feed_stroke` (the capsule for waiting strokes) is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:49:56 +02:00
aiongg 1f472d61ea Tests: report a bad PHOTOCRAFT_SWEEP_PART with assert!, which testkit's lints allow 2026-10-23 16:49:11 +00:00
John Turnbach 59929f65f2 test(io): style kept type layers as their Txt2 objects in add_type_layer
Review pointed out that the kept layers in the add_type_layer fixture
did not match their Txt2 objects: apply_txt2 copies kerning and the
OpenType features from the file, but photoshop_txt2 writes
MyriadPro-Regular at 12 pt while the layers were Inter at 24 pt. Since
this PR, build_txt2_at treats that as a style edit and rebuilds those
objects, so the fixture no longer exercised the unchanged-object path.

The kept layers now carry the object's font and size, and
add_type_layer asserts that each kept layer's Txt2 object is saved
unchanged. Without the font and size, that assertion fails in three of
the four tests that use the helper.
2026-10-23 12:45:44 -04:00
aiongg 20ad9f1f4e Docs: the final check before a PR runs the full sweep 2026-10-23 16:40:24 +00:00
aiongg 066ad384cd Tests: refuse a PHOTOCRAFT_SWEEP_PART that isn't a part number 2026-10-23 16:40:24 +00:00
John Turnbach eb06798f15 fix(format): cap the total bytes the shared file reader returns
Review pointed out that READ_CHUNK bounds each read but not the total
that photocraft_format::read_file returns, so a regular linked file that
keeps growing could keep a PSD export from finishing, and growth past
the stat length grew the buffer with infallible allocations. #8601 asks
for a MAX_OPEN_BYTES limit on the shared reader, not only on the PSD
call site.

read_all_with, which backs both read_file and read_all, now:

- fails with FileTooLarge once a reader has given more than
  MAX_OPEN_BYTES (256 GiB), or up front when the stat length is already
  over it, so a file over the limit is never embedded truncated;
- grows the buffer past the stat length only after a probe read finds
  more bytes, and with try_reserve, so a file that outgrows memory is an
  OutOfMemory error and a file read exactly to its length is not
  over-allocated.

The limit sits far above any document memory can hold, so opening large
PSB files is unchanged. The non-regular-file rejection is unchanged.

Tests: read::tests::reads_stop_at_the_total_limit (a file over the
limit, readers over it with any hint, a hint over it, an endless reader)
and read::tests::an_exact_hint_is_not_over_allocated.
2026-10-23 12:28:57 -04:00
aiongg 7d9abd95af CI: the git-sources check parses .cargo/config and .cargo/config.toml
A source replacement, a patch or a path override in either cargo config never shows up in
Cargo.lock, so the check refuses them. Both files are parsed as TOML, as Cargo reads them.
2026-10-23 16:18:57 +00:00
Hartmut NörenbergandClaude Opus 5.5 0bbe1e2079 fix(ui): Clone Source overlay for the Healing Brush, soft with the brush (#8907, #8908)
The overlay showed for the Clone Stamp only, although the Clone Source panel
drives the Healing Brush too (#8907). Clipped, it was a hard circle at the
brush radius, or a boolean mask for shaped tips, whatever the hardness, so a
soft brush previewed a hard disc while it painted a soft dab (#8908).

- `draw_clone_preview` runs for the Clone Stamp and the Healing Brush;
  Pattern Preview's repeating source stays the Clone Stamp's (`wrap`).
- Clipped, the overlay's alpha is the coverage of the dab the tool paints
  there (`retouch::stroke_coverage_within`): hardness, a soft tip's reach,
  shaped and sampled tips. The cache keeps the brush and covered area.
  A very large soft tip is cropped to the 1024 px source budget.
- `brush_cursor::tip_mask` is gone (its only user).
- snapshot example: `--hover-at X,Y` for what a tool shows under the pointer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:15:27 +02:00
SimoneRecchia fb9516a5b0 fix(ui): the shape Color Picker sets the next shape's colour only after the edit succeeds
confirm changed the next shape's colour (and turned its stroke on) before
running shape.edit, so an edit refused for another reason than a lock,
such as a job running on the document, still changed the tool defaults.
The edit now runs first and the defaults follow only when it succeeds.
2026-10-23 15:57:17 +00:00
Khawar Zamman WaniandClaude Opus 5.5 9df6c39da4 fix(ui): Select and Mask keeps its work on a second open and drops refused strokes
- Opening Select and Mask while it is open is an error, not a fresh workspace that
  silently discards the open one's edits, strokes and settings.
- A tool edit or Refine Edge Brush stroke refused at the engine's limits no longer
  stays drawn: the trail is cleared and the preview is rebuilt without it.

Addresses CodeRabbit review on #8896.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 21:23:43 +05:30
John Turnbach 0fdc625919 fix(plugins): bound a run's total plug-in memory, not just each instance
A filter run gives each band a fresh wasmi instance capped at 512 MiB of
linear memory, and ran one band per rayon worker. The cap was therefore
per instance times the thread count: one run on a 16-thread machine could
hold about 8 GiB, and a plug-in smart filter repeated that on every
re-render.

Limits gains max_total_memory_bytes (default 2 GiB), the budget for all
of one run's instances together, and Limits::parallel_bands(threads),
which allows only as many concurrent bands as max_memory_bytes fits into
that budget (at least one). Plugin::apply uses it to size its groups of
parallel bands, so with the defaults a run holds at most four instances
at the cap however many cores there are. Plug-ins configured with a
smaller per-instance cap keep every worker busy. The limit is listed in
docs/plugins.md.

Tests (crates/plugins/tests/abi.rs):
- parallel_bands_fit_the_total_memory_budget: 16 workers with the
  default limits run 4 bands at once, not 16 (failed before: 16 != 4).
- one_band_at_a_time_matches_parallel_bands: a budget that holds one
  instance still covers every band on an 8-thread pool, with the same
  pixels as parallel bands.

Fixes #8603
2026-10-23 11:43:32 -04:00
MarekSpodBiedry cddef0c6cc fix: File > Import > Variable Data Sets opens a file picker (#8816) 2026-10-23 17:37:40 +02:00
MarekSpodBiedry d387f52f1f Box-filter minified patterns in the CPU and GPU samplers (#8831) 2026-10-23 17:35:11 +02:00
John Turnbach 712d463f82 fix(io): read linked smart objects for PSD export as regular files only
Saving a PSD embeds the file a linked smart object names, and it read
that file with a bare std::fs::read. A link that names a FIFO blocked the
save forever (opening a FIFO for reading waits for a writer), and one
that names a device such as /dev/zero read until memory ran out. Every
other linked-file read already goes through photocraft_format::read_file,
which opens without blocking, refuses anything that is not a regular
file and reads in bounded chunks; the PSD exporter now uses it too. Such
a layer is written as pixels with a warning that says why, as for any
other unreadable link.

The new test psd_export::tests::a_linked_fifo_is_not_read exports a
document whose linked smart object points at a FIFO. Before the fix the
export never returned (the test times out after 30 s); now it finishes
and warns that the path is not a regular file.

Fixes #8601
2026-10-23 11:33:56 -04:00
MarekSpodBiedry 148e87944a Raise the Define Pattern size cap from 4000 to 8000 px per edge (#8820) 2026-10-23 17:31:29 +02:00
Jason DandClaude Opus 5.5 996b55eb41 Merge PR 3 (people.toml change) into PR 4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:25:23 -04:00
Jason DandClaude Opus 5.5 1078ab30c8 Merge PR 1's people.toml change into PR 3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:25:20 -04:00
Jason DandClaude Opus 5.5 6bcfd06b60 contributors: let jasallen's display name follow the GitHub profile
display_name took precedence over sync_github_name, so the sync had no
effect. Without it, About shows the public GitHub profile name.
Raised by CodeRabbit on #8885.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:25:19 -04:00
Khawar Zamman WaniandClaude Opus 5.5 4e816dc0ca feat(ui): Photoshop's Select and Mask workspace
Select > Select and Mask... opens a full-window workspace laid out as
Photoshop's, replacing the parameter dialog:

- options bar: tool, add/subtract, Size, Hardness (Brush), Sample All
  Layers, Select Subject, Refine Hair (greyed: #2671)
- tools: Quick Selection W, Refine Edge Brush R, Brush B, Object
  Selection W, Lasso and Polygonal Lasso L (one slot), Hand H, Zoom Z;
  Shift+W / Shift+L cycle
- the document under its tab, shown in the chosen view
- Properties: Remember Settings, View Mode (view letters, Show Edge J,
  Show Original P, Real-Time Refinement, High Quality Preview,
  Transparency/Opacity, Overlay colour and Indicates), Refine Mode
  (Object Aware greyed: #2788), Edge Detection, Global Refinements with
  Clear Selection and Invert, Output Settings; Reset, OK, Cancel

The tools become select.refineEdge `edits` (the Refine Edge Brush its
`refineStrokes`): OK is one history step, Cancel drops everything,
Ctrl+Z undoes per edit. The preview runs in the background on a reduced
copy (full size with High Quality Preview), reusing the selection after
the edits it already applied; Real-Time Refinement previews the stroke
being drawn. A targeted layer mask is refined and output to the mask.

Closes #7069. Closes #8148.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:47:26 +05:30
Batuhan Gözegü aedab302b2 ui: larger Align icons and overflow button; Save for Web keeps its width on an invalid Matte
- Move tool Align buttons: 16 px glyph in the 24 px box (was 12 px)
- Document/panel overflow button: 16 px glyph in the normal text colour (was 12 px, dim)
- Save for Web: a failed preview no longer draws its error beside the pane, which
  widened the dialog; the same message stays on the row above the panes
2026-10-23 18:12:29 +03:00
Jason DandClaude Opus 5.5 4b672c1b04 Merge PR 3's fixes into PR 4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:51:25 -04:00
Jason DandClaude Opus 5.5 d39ee7c73c Merge PR 1's allocation fix into PR 3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:51:23 -04:00
Jason DandClaude Opus 5.5 02384d30ce io: past 16 extra channels, layered TIFF resources describe only the stored ones
A layered TIFF stores at most MAX_EXTRA_SAMPLES (16) extra samples, but the
channel names (1006, 1045) and DisplayInfo (1077) still listed every
channel, and a Quick Mask past the cap kept its 1022 record pointing at a
sample that wasn't there. They now describe the first 16, and 1022 goes
when its channel wasn't stored. Raised by CodeRabbit on #8878.

Test: channels_past_sixteen_leave_no_resources_behind (18 alpha channels
and a Quick Mask); it fails without the fix (1006 lists 19 names).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:51:22 -04:00
Jason DandClaude Opus 5.5 009329b10d codecs: allocate the TIFF extra-sample write buffers fallibly
interleave_extras and the 16-bit and float sample copies used infallible
allocations sized by the image and its extra planes, so a save too large
for memory aborted the process. They now reserve with try_reserve_exact
and return an OutOfMemory error, which the encoder reports, as the
decoder already does through `zeroed`. Raised by CodeRabbit on #8885.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:42:43 -04:00
Finn NewickandClaude Opus 5.5 ee5d556014 fix(actions): keep out-of-range Camera Raw values as Photoshop steps
A recorded Camera Raw Filter value outside its slider's range (exposure
past +/-5, negative sharpening, ...) was imported and then clamped on
playback. It now leaves the step as a Photoshop step, using the PSD
mapping's ranges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:25:06 +01:00
John Turnbach 4dd1ccc2a3 fix(text): write a style-only type edit into the PSD's Txt2 style runs
Photoshop reads a type layer's character style from the document's Txt2
block, not from the layer's TySh. build_txt2_at kept a Txt2 object as it
was whenever its text still matched the layer, and built new style runs
only for edited or new objects. So a type.setStyle with no text change
(font, faux bold, size, ...) was saved into the TySh but not into Txt2,
and Photoshop reopened the layer in its old style. The same setStyle
together with a type.edit did reach Photoshop, because the object then
took the edited-object path.

An object is now kept only while its style runs agree with the layer's
character runs on every key the writer regenerates: font (by name through
the block's font list), size, faux bold and italic, leading, scales,
tracking, fill colour and the OpenType keys. The auto-kern mode is still
refitted separately. A key the file's run lacks, or holds as another
type, is skipped, so an unedited save still returns the file's block byte
for byte (#2374). When a key disagrees, the object goes through the
edited-object path: the file's structure is kept, its style runs are
rebuilt from the layer, and the glyph pen positions laid out in the old
style are dropped.

Regression test: text::tests::style_only_edit_restyles_the_kept_txt2_object
builds a Photoshop-shaped Txt2 (Arial-Black, faux bold on) and checks that
an unedited layer gets the block back byte for byte, that turning faux
bold off writes /2 false, and that a font change plus faux bold off names
AppleSDGothicNeo-Heavy in the runs. It fails on main (faux bold stays
true) and passes with the fix.

The io helper add_type_layer in psd_kerning.rs now applies the file's
Txt2 to its kept layers, as opening the file does. Before, those layers
contradicted their own Txt2 objects (no salt where the object had it on),
which the old keep-whatever-the-file-had behaviour hid.

Fixes #8415
2026-10-23 10:13:38 -04:00
Catur Sura 734e6163db Merge remote-tracking branch 'upstream/main' into feat/transform-ctrl-cursor 2026-10-23 21:12:19 +07:00
Matthias Schlich 99adb1829a fix(filters): allow measured Lens Flare values near math constants
clippy::approx_constant read some measured profile values (0.4343, 1.5707, 0.318 ...) as
mistyped constants. They are measurements; allow the lint in the generated table.
2026-10-23 16:08:28 +02:00
Finn NewickandClaude Opus 5.5 bbe7659ac3 fix(actions): refuse unreadable Camera Raw values, bad splits and curves
A recorded Camera Raw Filter step now stays a Photoshop step when a
value it records is not a number, when its curve splits are outside
0..=100 or out of order, or when a point curve is one that
filter.cameraRaw refuses (validate_curve), instead of replaying a
different look or failing on playback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:05:23 +01:00
Brandon ThomasandClaude Opus 5.5 e6d6fb45a4 Release 0.15.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:59:59 -04:00
Brandon ThomasandClaude Opus 5.5 ed1b6f4314 ci: run FreeBSD and Windows ARM64 checks on pushes to release
The release playbook runs the slow platform checks nightly and on every
push to release, so a regression shows up before a release is published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:59:59 -04:00
John Turnbach d5f561190b docs(atn): document adjustment_by_class 2026-10-23 09:59:42 -04:00
John Turnbach e6a3a4d511 fix(atn): import Photoshop's string class for Vibrance adjustment Sets
Photoshop's Properties panel records an edit of an existing Vibrance
layer with the class string id `vibrance`, not the `Vbrn` code the
adjustment table knows, so the whole Set imported as an unsupported
Photoshop step and stopped playback. Map the string class to the same
adjustment.

Fixes #8534
2026-10-23 09:59:42 -04:00
Dylan M. TaylorandCodebuff f27656b910 fix: restrict droplet shim permissions and annotate test range (SonarCloud) (#8870)
The generated droplet shim only needs to run as its creator, so 0700 keeps
other local accounts from reading the CLI path it invokes. The reversed
range in the arrow-key test is the case under test, not an accident.

🤖 Generated with Codebuff

Co-authored-by: Codebuff <noreply@codebuff.com>
2026-10-23 09:57:10 -04:00
Dylan M. TaylorandCodebuff f346b5c8f4 fix(vector): bound hostile geometry and raster work (#8769)
* fix(vector): bound hostile geometry raster work

Guard geometry and tracing operations against malformed dimensions and degenerate inputs with bounded work and safe failures.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

* fix(vector): address review (knot cap on split, relative identity tol, non-vacuous test)

* revert(geom): splitting past the quilt limit is intentional (smart_map test)

* fix(geom): cap identity tolerance at 1e-6 px

---------

Co-authored-by: Codebuff <noreply@codebuff.com>
2026-10-23 09:56:08 -04:00
Finn Newick 49e0c6dcd9 Merge remote-tracking branch 'origin/main' into feat/atn-camera-raw
# Conflicts:
#	crates/engine/src/atn_cmds.rs
2026-10-23 14:55:27 +01:00
92262d5950 fix(cms): confirm ICC profile identity by bytes, not the 64-bit hash alone (#8863)
Profile::content_hash is a fixed-key 64-bit SipHash of the ICC bytes, so a
crafted profile can share another profile's hash (about 2^32 work). Two
places took an equal hash as proof of an identical profile:

- transform::cached keyed its process-wide cache on the two hashes and the
  options, so a colliding profile was handed the other profile's cached
  transform and converted with the wrong colours.
- Profile::same_colors returned true on equal hashes, so a colliding
  profile was taken for the other one and a needed conversion was skipped.

Add Profile::same_bytes, which compares the ICC bytes (an Arc pointer check
first, then the hash, then the bytes). same_colors uses it instead of the
hash. Each transform cache entry now keeps the ICC bytes of its two
profiles; a hit counts only when they match, and a colliding pair gets its
own transform without replacing the cached entry. The transform is built
after the cache lock is released, as before.

The regression tests give Display P3 the content hash of sRGB (a stand-in
for a found collision): before the fix, same_colors called them the same
and the cache returned sRGB's transform for P3; now both see P3's colours.

Fixes #8613

Co-authored-by: John Turnbach <jturnbach@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:54:42 -04:00
Jason DandClaude Opus 5.5 72c2058fdf Merge PR 3's formatting fix into PR 4 (this branch's import call is kept)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:53:26 -04:00
Jason DandClaude Opus 5.5 c56fb1c066 io: rustfmt the PSD import call after the merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:52:58 -04:00