From 91d51e9f7382ea01d69b2e21452d4de56fefec8d Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 01:12:58 +0100 Subject: recording: reject a zero-length window --- src/config.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 95c1a18..e55226c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -205,8 +205,11 @@ impl Config { .parse() .unwrap_or(true), recording_window_seconds: env::var("RECORDING_WINDOW_SECONDS") - .unwrap_or_else(|_| "900".into()) - .parse() + .ok() + .and_then(|value| value.parse::().ok()) + // 0 would divide by zero in the mixer; cap the ring so a typo + // cannot allocate an unbounded amount of memory. + .filter(|seconds| (1..=3600).contains(seconds)) .unwrap_or(900), copyparty_url: env::var("COPYPARTY_URL") .unwrap_or_else(|_| "http://localhost:3939".into()), -- cgit v1.2.3