From bb3247f434e7b5fcb68a622ed85de13a96eb590c Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 24 May 2026 04:04:59 -0500 Subject: fix(recording): shell-quote device names and output paths in ffmpeg commands The X11 video path and the audio path interpolated the mic device, system device, and output filename straight into the shell command, so a device name or recording directory with a space (or other shell metacharacter) would break the command or mishandle the path. The Wayland video branch already quoted these; the other two did not. I wrapped all three in shell-quote-argument on both paths. To make the audio command testable, I extracted it into cj/recording--build-audio-command mirroring the existing cj/recording--build-video-command, then quoted there. Tests cover device names and filenames with spaces on both the X11 and audio builders. --- tests/test-video-audio-recording--build-video-command.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/test-video-audio-recording--build-video-command.el') diff --git a/tests/test-video-audio-recording--build-video-command.el b/tests/test-video-audio-recording--build-video-command.el index 7f54f053..3b79c9ec 100644 --- a/tests/test-video-audio-recording--build-video-command.el +++ b/tests/test-video-audio-recording--build-video-command.el @@ -76,6 +76,22 @@ ;; Filename should be quoted/escaped (should (string-match-p "recording" cmd)))))) +(ert-deftest test-video-audio-recording--build-video-command-boundary-x11-device-quoted () + "Boundary: X11 device names with spaces are shell-quoted." + (let ((cj/recording-mic-boost 1.0) + (cj/recording-system-volume 1.0)) + (let ((cmd (cj/recording--build-video-command + "device with spaces" "sys" "/tmp/out.mkv" nil))) + (should (string-match-p "device\\\\ with\\\\ spaces" cmd))))) + +(ert-deftest test-video-audio-recording--build-video-command-boundary-x11-filename-quoted () + "Boundary: X11 output filename with spaces is shell-quoted." + (let ((cj/recording-mic-boost 1.0) + (cj/recording-system-volume 1.0)) + (let ((cmd (cj/recording--build-video-command + "mic" "sys" "/tmp/my recording.mkv" nil))) + (should (string-match-p "my\\\\ recording\\.mkv" cmd))))) + (ert-deftest test-video-audio-recording--build-video-command-boundary-zero-volume () "Zero volume values produce 0.0 in the command." (let ((cj/recording-mic-boost 0.0) -- cgit v1.2.3