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

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


On Tue, Jan 17, 2012 at 12:32:43AM +0100, Clément Bœsch wrote:
> 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.

Don't bother, there's lots of errors.
I'd rather have one green valgrind fate.
We can run the other case if someone else volunteers to
host valgrind.
I guess I could set it up on the ppc64 server some time.


More information about the ffmpeg-devel mailing list