[FFmpeg-devel] [PATCH] AC3 decoder stability

Justin Ruggles justinruggles
Sun Mar 23 01:44:23 CET 2008


Here is the least invasive and fastest solution I could come up with for
fixing the problem with overreading the input buffer in the AC3 decoder.
 I went through the specs and calculated the maximum possible AC3 frame
size.  This patch adds a fixed-size input buffer to the
AC3DecodeContext, copies the user-provided input buffer to the context
buffer, and reads the frame from that instead.  This way there will be
no possibility for buffer overread when a damaged or malformed frame is

speed tests:
           stereo       5.1   5.1->stereo downmix
svn:       0.768s      2.804s      2.076s
patched:   0.780s      2.816s      2.068s

valgrind tests on a damaged stream, using '-er 0':
svn:  2909 errors from 35 contexts
patched: 0 errors from  0 contexts


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ac3_copy_buffer.diff
Type: text/x-diff
Size: 1181 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080322/72bece11/attachment.diff>

More information about the ffmpeg-devel mailing list