[FFmpeg-devel] Memory allocation failure

Ramiro Polla ramiro.polla
Sat Sep 12 20:05:06 CEST 2009


On Sun, Sep 6, 2009 at 6:52 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Sep 05, 2009 at 11:41:18PM -0300, Ramiro Polla wrote:
>> Hi,
>>
>> While testing some memory allocation failures I thought about checking
>> how far FFmpeg goes without segfaulting when some av_malloc() call
>> fails.
>>
>> With malloc_errors_test.diff I tested from 1 up to 127 and then got
>> bored. In malloc_errors.diff there are the changes I was making. Some
>> were trivial, some I didn't know what to do and just commented on.
>> Thoroughly checking for malloc return value errors would take so long
>> I gave up.
>
> feel free to commit what you are sure is correct
> (for example a *exit() in ffmpeg.c cant be too wrong ...)

Committed some parts.

Attached patches are:
add_to_pktbuf.diff is part of the previous patch but I'm not exactly
sure it's the best way to go.
alloc_context.diff checks for return value of
av{codec,format}_alloc_context() throughout FFmpeg except for the
contexts allocated for option handling in ffplay.c and ffmpeg.c (for
now).
alloc_frame.diff checks return value of all uses of avcodec_alloc_frame().

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_to_pktbuf.diff
Type: text/x-diff
Size: 1533 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090912/5ba00ee8/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_context.diff
Type: text/x-diff
Size: 3886 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090912/5ba00ee8/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_frame.diff
Type: text/x-diff
Size: 8663 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090912/5ba00ee8/attachment-0002.diff>



More information about the ffmpeg-devel mailing list