[FFmpeg-cvslog] avcodec/mpeg12dec: Check for overread in mpeg_decode_slice()

Michael Niedermayer git at videolan.org
Fri Jan 24 18:38:54 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 24 17:45:26 2014 +0100| [76b5e99ce9c1245e2e426203a1f535a5d83cced6] | committer: Michael Niedermayer

avcodec/mpeg12dec: Check for overread in mpeg_decode_slice()

This is needed in case the checked bitstream reader is disabled

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

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

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index f574997..60c1a71 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1846,6 +1846,8 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
         }
     }
 eos: // end of slice
+    if (get_bits_left(&s->gb) < 0)
+        return AVERROR_INVALIDDATA;
     *buf += (get_bits_count(&s->gb)-1)/8;
     av_dlog(s, "y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y);
     return 0;



More information about the ffmpeg-cvslog mailing list