[FFmpeg-devel] [PATCH] ffmpeg: check tcgetattr result.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jan 17 00:11:44 CET 2012


This fixes parallel FATE (make fate -j4) failing under valgrind with:
 Syscall param ioctl(TCSET{S,SW,SF}) points to uninitialised byte(s)
    at 0x5D98B23: tcsetattr (tcsetattr.c:88)
    by 0x43D66C: term_init (ffmpeg.c:734)
    by 0x43CD8D: main (ffmpeg.c:5071)
  Address 0x7fefffdd0 is on thread 1's stack
  Uninitialised value was created by a stack allocation
    at 0x43D5B0: term_init (ffmpeg.c:716)

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 ffmpeg.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 434302d..3880f35 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -718,7 +718,7 @@ static void term_init(void)
     if(!run_as_daemon){
     struct termios tty;
 
-    tcgetattr (0, &tty);
+    if (tcgetattr (0, &tty) == 0) {
     oldtty = tty;
     atexit(term_exit);
 
@@ -732,6 +732,7 @@ static void term_init(void)
     tty.c_cc[VTIME] = 0;
 
     tcsetattr (0, TCSANOW, &tty);
+    }
     signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */
     }
 #endif
-- 
1.7.8.3



More information about the ffmpeg-devel mailing list