[FFmpeg-devel] [PATCH] Fix potential av_find_opt() crash if context is NULL
Stefano Sabatini
stefano.sabatini-lala
Thu Oct 30 00:14:36 CET 2008
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.
Regards.
--
FFmpeg = Fast & Furious Meaningful Power Elaborated Goblin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-potential-av-opt-find-crash-01.patch
Type: text/x-diff
Size: 1107 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081030/f4f3d913/attachment.patch>
More information about the ffmpeg-devel
mailing list