[FFmpeg-devel] [PATCH] Fix potential av_find_opt() crash if context is NULL
Thu Oct 30 16:33:05 CET 2008
On date Thursday 2008-10-30 14:32:29 +0100, Michael Niedermayer encoded:
> On Thu, Oct 30, 2008 at 12:14:36AM +0100, Stefano Sabatini wrote:
> > On date Wednesday 2008-10-29 00:43:16 +0100, Michael Niedermayer encoded:
> > > On Wed, Oct 29, 2008 at 12:27:35AM +0100, Stefano Sabatini wrote:
> > > > Hi, as in patch.
> > > >
> > > > This happens for example in libavfilter-soc with:
> > > > ffplay -foo x
> > > >
> > > > when --enable-avfilter, in this case sws_opts is NULL.
> > >
> > > could you elaborate a little more how above is causing a NULL
> > > to be passed.
> > > All readers surely could guess but i think it would improve the
> > > responses if everyone would know what happens where
> > We have:
> > #if !ENABLE_AVFILTER
> > sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
> > #endif
> > So sws_opts is not initialized and is NULL.
> > Then when an unknown option is parsed and processed in opt_default we
> > have:
> > if(!o)
> > o = av_set_string2(sws_opts, opt, arg, 1);
> > which calls av_find_opt() and crashes.
> > Optionally we could specify in the doc the condition for which
> > opt_find_opt has to take always a non-NULL value as obj, but I think
> > it is more robust and semnatically more correct to simply return NULL
> > in case of a NULL obj.
> bleh ...
> the problem is obvious in the ENABLE_AVFILTER #ifdefs
> if sws is not used by ffmpegm sws_opts itself should not even exist with
Mhh.. so what about this? And I'm not sure it is the best solution...
FFmpeg = Fiendish and Frenzy Multimedia Porno Exxagerate Generator
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 705 bytes
Desc: not available
More information about the ffmpeg-devel