[FFmpeg-devel] MPADecodeContext on stack

Andreas Öman andreas
Mon Jan 19 17:56:54 CET 2009


MPADecodeContext is allocated on the stack at two places:


sizeof(MPADecodeContext) = ~23k

This is, by far, the biggest stack consumer in ffmpeg.
(I recently bumped into a stack overflow on an embedded system)

Proposed patch fixes this by splitting out the required fields
for ff_mpegaudio_decode_header(), which is what is used at those places.

It's a bit intrusive to mpegaudiodec.c. Another option might be to copy
the fields back into MPADecodeContext, or malloc() MPADecodeContext
at those places instead.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpa.patch
Type: text/x-patch
Size: 19950 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090119/d462b5d0/attachment.bin>

More information about the ffmpeg-devel mailing list