Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge PR #3006: CLI-HOSTILE: render --set refuses inf / NaN instead of dropping the value

aiongg6ad10a6bf461
diff --cc apps/lightcraft-cli/tests/it/cli.rs
index 967f2f588,9faa0a14d..0664677ee
--- a/apps/lightcraft-cli/tests/it/cli.rs
+++ b/apps/lightcraft-cli/tests/it/cli.rs
@@@ -181,9 -176,15 +181,15 @@@ fn render_subcommand()
assert_eq!((d.width, d.height), (120, 80));
assert!(mean(&out) > mean(&plain) + 10.0);
// Bad control id fails cleanly.
- let o = Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "nope=1"]).output().unwrap();
+ let o = Command::new(binary()).args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "nope=1"]).output().unwrap();
assert!(!o.status.success());
assert!(String::from_utf8_lossy(&o.stderr).contains("unknown control"));
+ // Values that parse as f64 but are not finite fail cleanly too.
+ for bad in ["light.exposure=inf", "light.exposure=-inf", "light.exposure=NaN", "light.exposure=1e999"] {
+ let o = Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", bad]).output().unwrap();
+ assert!(!o.status.success(), "{bad} must be refused");
+ assert!(String::from_utf8_lossy(&o.stderr).contains("not a finite number"), "{bad}");
+ }
}
/// Issue #1730: `render --settings` took a `.lcpreset` from `preset.export`, ignored its wrapper