[FFmpeg-devel] [PATCH] avfilter/all: handle ff_formats_unref correctly

Michael Niedermayer michaelni at gmx.at
Fri Nov 20 21:56:33 CET 2015


On Fri, Nov 20, 2015 at 03:07:36PM -0500, Ganesh Ajjanagadde wrote:
> On Fri, Nov 20, 2015 at 3:00 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Sun, Nov 15, 2015 at 07:21:11PM -0500, Ganesh Ajjanagadde wrote:
> >> Recent commits 6aaac24d72a7da631173209841a3944fcb4a3309 and
> >> 3835554bf8ed78539a3492c239f979c0ab03a15f made progress towards cleaning
> >> up usage of the formats API, and in particular fixed possible NULL pointer
> >> dereferences.
> >>
> >> This commit addresses the issue of possible resource leaks when one call
> >> fails and the others don't.
> >>
> >> Fixes: CID 1338330, 1338329, 1338327, 1338326.
> >>
> >> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> >> ---
> >>  libavfilter/af_channelmap.c |  7 +++++--
> >>  libavfilter/vf_alphamerge.c |  7 +++++--
> >>  libavfilter/vf_overlay.c    | 30 +++++++++++++++++++++---------
> >>  3 files changed, 31 insertions(+), 13 deletions(-)
> >
> > if the error pathes have been tested with valgrind or assan (and
> > simulating/forcing them to trigger) then this should be ok
> 
> Unfortunately, I have no idea how to test such code pathways easily. -
> how does one force a particular malloc to fail? Isn't the cheapest

-this = particular_malloc()
+if (somerandom() % someconstant  == 0)
+    this = NULL;
+ else
+    this = particular_malloc()

this also should/would make some (not neccesarily the first) call
to fail


> solution simply to submit a Coverity build for this and check?

coverity seems not to detect everything


> 
> >
> > [...]
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > Many that live deserve death. And some that die deserve life. Can you give
> > it to them? Then do not be too eager to deal out death in judgement. For
> > even the very wise cannot see all ends. -- Gandalf
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151120/9126bd44/attachment.sig>


More information about the ffmpeg-devel mailing list