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

Clément Bœsch ubitux at gmail.com
Tue Jan 17 00:32:43 CET 2012


On Tue, Jan 17, 2012 at 12:11:44AM +0100, Reimar Döffinger wrote:
> 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

I don't know if it's the correct way to deal with the issue, but I confirm
it fixes the issue here too.

Can this also helps https://ffmpeg.org/trac/ffmpeg/ticket/42 (or make
it worse)?

BTW, when all the valgrind tests will be in the green, I'll remove
--undef-value-errors=no on the box and give it try.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120117/6d67a939/attachment.asc>


More information about the ffmpeg-devel mailing list