[FFmpeg-devel] [PATCH] Fix ALAC crashes

Jason Garrett-Glaser darkshikari
Thu Oct 7 22:56:54 CEST 2010

For some bizarre reason, ALAC initializes from extradata in the decode
loop instead of init loop.  I don't know why, and I don't want to
change it without clearance from someone who knows why it was done
this way.

But because of this, if ALAC extradata is corrupt, the ALAC decoder
will return success but not set the sample format, causing a crash
(divide by zero) in ffmpeg.c because "bps" is zero.

This patch fixes this by returning failure.  However, it doesn't make
decoding terminate like it should; instead, ffmpeg still tries to
decode the whole stream and spams a massive sequence of errors:

Error while decoding stream #0.0mes
Error while decoding stream #0.0mes
Error while decoding stream #0.0mes
Error while decoding stream #0.0mes
    Last message repeated 455 times

So this should be fixed separately, IMO.

On a vaguely related note, this problem is caused by this CAF file (
http://www.mediafire.com/?ieepkh09s1q5ven ), which demonstrates that
the CAF demuxer isn't demuxing the extradata for ALAC correctly.

Dark Shikari
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alac.diff
Type: application/octet-stream
Size: 1172 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101007/01f5abed/attachment.obj>

More information about the ffmpeg-devel mailing list