mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-22 03:32:39 -05:00
The roi quad is stored raw from the control channel (crop.useRoi passes serde_json's [f64;4] straight through, unlike the sibling edge fields, which are clamped to plus/minus 20 000) and nothing repairs it on load. Crop::edges converted it with round() as i32 and subtracted raw: an x of -1e12 saturates to i32::MIN and w as i32 - l overflows in debug builds, wrapping to a wrong-but-bounded crop in release. Clamp each converted edge to the same plus/minus 20 000 the sibling fields use and subtract with saturating_sub in edges() and frame_size(). Regression test: hostile_roi_cannot_overflow_crop_math — panics at crates/project/src/render_queue.rs:774 on main; with the fix the hostile quad degrades to a 1x1 frame and the sane-ROI behavior is unchanged.