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

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Dec 4 15:41:08 CET 2015


On Fri, Nov 20, 2015 at 3:56 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> 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

Took too seriously their statement "Coverity's implementation of
static analysis can follow all the possible paths of execution through
source code (including interprocedurally)". Their "can" seems to
really be "we sometimes do so, but no formal guarantees".

Anyway, all subsumed with a CID patchset sent just now, thanks.

[...]


More information about the ffmpeg-devel mailing list