[FFmpeg-devel] [PATCH] Fix the ffmpeg -rc_eq "foo" bug

Stefano Sabatini stefano.sabatini-lala
Sun Jul 13 23:45:47 CEST 2008


On date Sunday 2008-07-13 19:01:31 +0200, Michael Niedermayer encoded:
> On Sun, Jul 13, 2008 at 06:36:09PM +0200, Stefano Sabatini wrote:
> > Hi all, currently ffmpeg crashes when setting the option -rc_eq.
> > 
> > There are currently two bugs involved, the first one:
> > 
> > +++ libavcodec/opt.c    (working copy)
> > @@ -196,7 +196,7 @@
> >      }
> > 
> >      if(alloc){
> > -        av_free((void*)(((uint8_t*)obj) + o->offset));
> > +        av_free(*(void**)(((uint8_t*)obj) + o->offset));
> >          val= av_strdup(val);
> >      }
> > 
> > this because obj + o->offset is a pointer to the location which
> > contains the pointer to the string.
> > 
> > The rc_eq string needs to be strdup()ed in
> > avcodec_get_context_defaults2 since av_set_string2() may free that
> > pointer when it sets again the rc_eq string, which issues a SIGSEGV if
> > the string is static.
> > 
> > Note also that there is a memleak here, the rc_eq set by
> > avcodec_get_context_defaults2() or by av_set_string() has to be
> > explicitly freed by the user before to free the AVCodecContext.
> 
> patches ok

Both applied, regards.
-- 
FFmpeg = Foolish and Furious Meaningless Problematic Emblematic Gem




More information about the ffmpeg-devel mailing list