[FFmpeg-devel] MPADecodeContext on stack

Michael Niedermayer michaelni
Thu Jan 22 01:11:48 CET 2009

On Mon, Jan 19, 2009 at 05:56:54PM +0100, Andreas ?man wrote:
> Hi
> MPADecodeContext is allocated on the stack at two places:
> libavformat/mp3.c
> libavcodec/mpegaudio_parser.c
> sizeof(MPADecodeContext) = ~23k

> This is, by far, the biggest stack consumer in ffmpeg.

i do not belive this entirely

> (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.

i think this could be done simpler similarly to how Picture/AVFrame is done

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090122/9307a949/attachment.pgp>

More information about the ffmpeg-devel mailing list