M4.12: never crash: hostile input in New Comp from Selection, an empty work area in Cache Frames When Idle
Following AGENTS.md's Never crash rules for the M3 / M4 additions: - Cache Frames When Idle panicked (`clamp` with min > max) when the work area was inverted (start set past the end); an empty work area now has nothing to cache. - `file.newCompFromSelection`: the sequence overlap times the layer count overflowed for a huge `overlapDuration` (wrapping to a wrong comp length without overflow checks); negative or non-finite values fall back to 1 s and the product saturates. The lead item is read with `get()` instead of indexing. - Layer Settings' enablement reads the first selected layer with `first()`. - Regression tests for both (each failed before the fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
339a05d771
commit
b21e04b301
@@ -257,3 +257,17 @@ fn cache_frames_when_idle_fills_the_work_area() {
|
||||
}
|
||||
assert_eq!(n, 240, "the work area is cached while idle");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cache_frames_when_idle_survives_an_inverted_work_area() {
|
||||
let mut h = harness();
|
||||
// Start set past the end: an empty work area (it panicked in `clamp` / `rem_euclid`).
|
||||
invoke(&mut h, "comp.workArea", json!({"end": 2.0}));
|
||||
invoke(&mut h, "comp.workArea", json!({"start": 5.0}));
|
||||
invoke(&mut h, "playback.cacheWhenIdle", json!({"value": true}));
|
||||
for _ in 0..150 {
|
||||
h.step();
|
||||
std::thread::sleep(std::time::Duration::from_millis(2));
|
||||
}
|
||||
assert!(!h.state().playback.playing);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user