Files
photocraft/crates/engine
ba222715b3 filter.cameraRaw: refuse an area too large to develop instead of overflowing (#1183)
* filter.cameraRaw: refuse an area too large to develop instead of overflowing

Fixes #962. `rgba_region` sized its buffer with `area.width() * area.height()`
in u32, so a legal 65536×65536 canvas (2^32 pixels) overflowed the product and
the command's `run` panicked; dispatch turned that into an internal error. In
release the product wraps to 0 and the first tile read would index past the
empty buffer instead.

The command now checks the area it is about to develop (canvas ∪ the layer's
content) against `MAX_RAW_PIXELS` (400 MP, ≥ 48 bytes per pixel of working
memory) and returns bad-params with the size and the limit. `camera_raw_surface`
carries the same guard so the preview and Smart Filter paths can never overflow
either; the buffer length is computed in u64.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* lens_cmds tests: move the wasm32 cfg back onto lens_correction_batch_over_files

The new Camera Raw test was inserted between the cfg and the batch-over-files
test, which gated the wrong test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: wstock <1394687+wstock@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-08 16:38:15 -04:00
..