[FFmpeg-devel] Testing failure paths (Was: Re: [PATCH v2 2/3] avformat/hashenc: use an array of hashes)

James Almer jamrial at gmail.com
Wed Sep 11 18:49:57 EEST 2019


On 9/11/2019 11:53 AM, Moritz Barsnick wrote:
> On Wed, Sep 11, 2019 at 10:39:40 -0300, James Almer wrote:
>>> +static void hash_free(struct AVFormatContext *s)
>>> +{
>>> +    struct HashContext *c = s->priv_data;
>>> +    av_hash_freep(&c->hashes[0]);
>>
>> AVOutputFormat.deinit() is called when AVOutputFormat.init() fails, so
>> c->hashes can be NULL. same with the framehash muxer.
> 
> BTW, do we have any tools or methods for triggering these failure paths
> (without modifying the tested code)? Like an LD_PRELOAD lib to randomly
> or directedly fail av_malloc*()? Or is all this covered by review and
> fuzzing(?) only?
> 
> I only do random short use cases and corner/error cases with valgrind,
> but that doesn't hit ENOMEM.

There's ulimit on Linux, but never used it. I know it's the standard way
to emulate low RAM environments to trigger ENOMEM errors and detect
unchecked allocs.

> 
> Thanks,
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-devel mailing list