The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
fix(project): has_non_finite catches transition_in and text in UpdateClip
leocad7bcb3de5893
diff --git a/src/crates/concat-project/src/commands/mod.rs b/src/crates/concat-project/src/commands/mod.rsindex 478b1073..9d852bff 100644--- a/src/crates/concat-project/src/commands/mod.rs+++ b/src/crates/concat-project/src/commands/mod.rs@@ -806,8 +806,24 @@ impl Command {start,duration,offset_y,+ style,..- } => bad([*start]) || bad(*duration) || bad(*offset_y),+ } => {+ bad([*start])+ || bad(*duration)+ || bad(*offset_y)+ || style.iter().any(|style| {+ bad([+ style.font_size,+ style.font_weight,+ style.opacity,+ style.stroke_width,+ style.line_height,+ style.tracking,+ style.max_width,+ ])+ })+ }Command::AddLayerClip {start, duration, ..} => bad([*start]) || bad(*duration),@@ -845,6 +861,22 @@ impl Command {.any(|crop| bad([crop.left, crop.top, crop.right, crop.bottom]))|| patch.filters.as_deref().is_some_and(bad_chain)|| patch.video_effects.as_deref().is_some_and(bad_chain)+ || patch+ .transition_in+ .iter()+ .flatten()+ .any(|tr| bad([tr.duration]))+ || patch.text.iter().flatten().any(|style| {+ bad([+ style.font_size,+ style.font_weight,+ style.opacity,+ style.stroke_width,+ style.line_height,+ style.tracking,+ style.max_width,+ ])+ })}Command::SetClipSpeed { speed, .. } => bad([*speed]),Command::SetClipTransform {diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex 5f45331d..911bb105 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -529,6 +529,42 @@ mod tests {assert_eq!(editor.project(), &before, "nothing changed");}+ #[test]+ fn nan_in_transition_or_text_patch_is_refused() {+ let (mut editor, _, clip_id) = fixture();+ let before = editor.project().clone();+ // A transition whose duration is NaN must be caught.+ let bad_transition = Command::UpdateClip {+ clip_id: clip_id.clone(),+ patch: ClipPatch {+ transition_in: Some(Some(crate::model::Transition {+ id: "cross-fade".to_owned(),+ duration: f64::NAN,+ })),+ ..Default::default()+ },+ };+ assert_eq!(+ editor.apply(bad_transition).expect_err("refused"),+ crate::CommandError::NotANumber+ );+ // A text style whose font_size is infinite must be caught.+ let mut style = TextStyle::default();+ style.font_size = f64::INFINITY;+ let bad_text = Command::UpdateClip {+ clip_id: clip_id.clone(),+ patch: ClipPatch {+ text: Some(Some(style)),+ ..Default::default()+ },+ };+ assert_eq!(+ editor.apply(bad_text).expect_err("refused"),+ crate::CommandError::NotANumber+ );+ assert_eq!(editor.project(), &before, "nothing changed");+ }+#[test]fn a_document_from_a_newer_build_is_refused() {let (editor, _, _) = fixture();