mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-20 00:15:01 +02:00
`commands::int` returns an unbounded i64, and the geometry call sites narrowed it with `as i32`, which truncates by multiples of 2^32: layer.translate moved a layer 50 px for `dx = 2^32 + 50` and to a large negative offset for `dx = 3e9`; select.rect and document.pixel read unrelated coordinates; image.crop cropped a rectangle unrelated to the numbers passed; artboard rects landed elsewhere. No panic, no Err - the document was silently mutated and then autosaved, and the behaviour is identical in debug and release, so panic_hunt cannot see it either. - new `commands::int_i32(cmd, p, key)` narrows with a bad-params error instead of a wrapping cast; select.rect, document.pixel, layer.translate, image.crop and the artboard rect keys go through it - image.crop builds its rectangle with saturating_add (x + w overflow) - edit.contentAwareFill's `area` parser returns a bad-params error for malformed arrays (wrong length, non-numbers, non-finite) and saturating arithmetic for huge ones - `[1e30, 0, 1e30, 10]` overflowed the i32 additions before (a debug-build panic, a garbage sampling window in release) - filters' integer helper clamps out-of-range values like the neighbouring filter params instead of wrapping (`3e9` came back as a negative offset) |
||
|---|---|---|
| .. | ||
| tests.rs | ||