[FFmpeg-cvslog] avcodec/mpeg12dec: check slice size before trying to decode it

Michael Niedermayer git at videolan.org
Tue Aug 13 19:53:15 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Aug 13 19:36:50 2013 +0200| [97064019279d227669ea3db583a8a8aa47e970ba] | committer: Michael Niedermayer

avcodec/mpeg12dec: check slice size before trying to decode it

Fixes assertion failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpeg12dec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9b17941..262a5a3 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2299,6 +2299,11 @@ static int decode_chunks(AVCodecContext *avctx,
                 if (s2->picture_structure == PICT_BOTTOM_FIELD)
                     mb_y++;
 
+                if (buf_end - buf_ptr < 2) {
+                    av_log(s2->avctx, AV_LOG_ERROR, "slice too small\n");
+                    return AVERROR_INVALIDDATA;
+                }
+
                 if (mb_y >= s2->mb_height) {
                     av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
                     return -1;



More information about the ffmpeg-cvslog mailing list