[FFmpeg-cvslog] ac3dec: Don't consume more data than the actual input packet size

Martin Storsjö git at videolan.org
Wed Sep 25 23:34:49 CEST 2013


ffmpeg | branch: release/0.10 | Martin Storsjö <martin at martin.st> | Mon Jul 15 11:28:46 2013 +0300| [729143e2d27d5f06e6c4b959f4808a8a5fa7ca25] | committer: Sean McGovern

ac3dec: Don't consume more data than the actual input packet size

This was handled properly in the normal return case at the end
of the function, but not in this special case.

Returning a value larger than the input packet size can cause
problems for certain library users.

Returning the actual input buffer size unconditionally, since
it is not guaranteed that frame_size is set to a sensible
value at this point.

Cc: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 8f24c12be7a3b3ea105e67bba9a867fe210a2333)

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=729143e2d27d5f06e6c4b959f4808a8a5fa7ca25
---

 libavcodec/ac3dec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 61097e9..2eac0ed 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1345,7 +1345,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
                 av_log(avctx, AV_LOG_ERROR, "unsupported frame type : "
                        "skipping frame\n");
                 *got_frame_ptr = 0;
-                return s->frame_size;
+                return buf_size;
             } else {
                 av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
             }



More information about the ffmpeg-cvslog mailing list