[FFmpeg-devel] [PATCH] Adding av_abort() : adding custom handlers for abort().

Marton Balint cus at passwd.hu
Wed Jul 27 20:39:39 EEST 2022



On Wed, 27 Jul 2022, Hendrik Leppkes wrote:

> On Wed, Jul 27, 2022 at 4:03 PM Julien Vary <jvary at genetec.com> wrote:
>>
>> Replaced all abort() by av_abort() in the code.
>> On production systems, when dealing with malformed data,
>> avcodec was sometime aborting, with no core/memory dump
>> available to troubleshoot after-the-fact.
>> Adding av_abort_set_callback to register a custom
>> function (instead of the default straight abort()
>> behavior), to allow dumping before the actual abort().
>> Also 'av_logging' the av_abort() location.
>>
>> Signed-off-by: Julien Vary <jvary at genetec.com>
>
> abort() should generally not be in a reachable part of the code - not
> inside any of the libraries anyway, ffmpeg.c is a different topic.
> If it is reachable with any input files, and not just present to shut
> up compilers, this is a bug and should be addressed to return an error
> instead.
>
> Therefore, we should address those cases, and just leave abort as-is
> otherwise. Nevermind that av_abort would need to be a public function,
> which sounds like a really bad idea.

IMHO abort() calls should all be converted to av_assert0(0). Or is 
there a use case for using abort() directly? I don't think so.

Or maybe we could add av_abort() as an alias to av_assert0(0), which 
eventually just calls abort()...

Regards,
Marton


More information about the ffmpeg-devel mailing list