[FFmpeg-devel] [PATCH] Segfault occurs if encoder initialization fails
Benoit Fouet
benoit.fouet
Tue Apr 6 11:52:48 CEST 2010
On Tue, 6 Apr 2010 02:48:54 +0200 Michael Niedermayer wrote:
> On Mon, Apr 05, 2010 at 06:08:23PM -0500, Craig Thomasson wrote:
> > Hi,
> >
> > This patch fixes an issue where ffmpeg segfaults if the encoder fails to
> > initialize. avcodec_close() needs to check if avctx->codec is non-null
> > before dereferencing it, as it is set to null prior to this call when
> > encoder init fails.
> >
> > --------------------------------
> > diff -u ffmpeg/libavcodec/utils.c working/libavcodec/utils.c
> > --- ffmpeg/libavcodec/utils.c 2010-04-05 17:26:55.000000000 -0500
> > +++ working/libavcodec/utils.c 2010-04-05 17:36:00.000000000 -0500
> > @@ -710,7 +710,7 @@
> > avctx->codec->close(avctx);
> > avcodec_default_free_buffers(avctx);
> > av_freep(&avctx->priv_data);
> > - if(avctx->codec->encode)
> > + if(avctx->codec && avctx->codec->encode)
> > av_freep(&avctx->extradata);
>
> probably ok
>
> [...]
Applied
Ben
More information about the ffmpeg-devel
mailing list