[FFmpeg-cvslog] avcodec/mpeg12dec: Fix missing slice handling without padding

Michael Niedermayer git at videolan.org
Wed Feb 24 03:27:47 CET 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Feb 24 01:44:27 2016 +0100| [10fa50c156ead31423e0f787c2152aeab841c2f3] | committer: Michael Niedermayer

avcodec/mpeg12dec: Fix missing slice handling without padding

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mpeg12dec.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 4bdb32a..f6089e4 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1871,6 +1871,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
 
         if (++s->mb_x >= s->mb_width) {
             const int mb_size = 16 >> s->avctx->lowres;
+            int left;
 
             ff_mpeg_draw_horiz_band(s, mb_size * (s->mb_y >> field_pic), mb_size);
             ff_mpv_report_decode_progress(s);
@@ -1910,12 +1911,13 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
             // in cases where the slice is completely outside the visible
             // area, we detect this here instead of running into the end expecting
             // more data
+            left = get_bits_left(&s->gb);
             if (s->mb_y >= ((s->height + 15) >> 4) &&
                 !s->progressive_sequence &&
-                get_bits_left(&s->gb) <= 8 &&
-                get_bits_left(&s->gb) >= 0 &&
+                left <= 25 &&
+                left >= 0 &&
                 s->mb_skip_run == -1 &&
-                show_bits(&s->gb, 8) == 0)
+                (!left || show_bits(&s->gb, left) == 0))
                 goto eos;
 
             ff_init_block_index(s);



More information about the ffmpeg-cvslog mailing list