This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/9.0
in repository ffmpeg.

commit 576af84e6352bff06d1f8f73ad56c8bfa98dbbbc
Author:     Zhao Zhili <[email protected]>
AuthorDate: Mon Jun 22 20:36:10 2026 +0800
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Tue Nov 24 19:55:14 2026 +0100

    fftools/ffmpeg: disable stdin interaction when fd 0 is closed
    
    When the parent process closes stdin before launching ffmpeg, fd 0 is
    left invalid. The first opened input file then reuses fd 0, and the
    read_key() poll in the transcode loop reads from that input instead of
    the terminal, stealing bytes and corrupting the stream.
    
    Fixes #23539
    
    (cherry picked from commit 0b4798f7ab964e288241536175228179acb1410f)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 fftools/ffmpeg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index b394243f59..d38acffbdf 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -216,6 +216,16 @@ void term_init(void)
 #endif
 
 #if HAVE_TERMIOS_H
+    /* A closed fd 0 is later reused by the first opened input file. read_key()
+     * would then read from that input instead of the terminal and corrupt the
+     * stream, so disable interaction when fd 0 is not an open descriptor.
+     */
+    if (stdin_interaction && fcntl(0, F_GETFD) == -1) {
+        av_log(NULL, AV_LOG_WARNING,
+               "fd 0 is not an open file descriptor, stdin interaction 
disabled\n");
+        stdin_interaction = 0;
+    }
+
     if (stdin_interaction) {
         struct termios tty;
         if (tcgetattr (0, &tty) == 0) {

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to