changeset 10607:6e672d7eb297 libavcodec

Move "slice below image" check from mpeg_decode_slice to its caller. Should fix issue1277.
author michael
date Mon, 30 Nov 2009 23:08:25 +0000
parents 9ea5f2f1874f
children dab94852ac8b
files mpeg12.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg12.c	Mon Nov 30 21:22:01 2009 +0000
+++ b/mpeg12.c	Mon Nov 30 23:08:25 2009 +0000
@@ -1673,10 +1673,7 @@
     s->resync_mb_x=
     s->resync_mb_y= -1;
 
-    if (mb_y >= s->mb_height){
-        av_log(s->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s->mb_height);
-        return -1;
-    }
+    assert(mb_y < s->mb_height);
 
     init_get_bits(&s->gb, *buf, buf_size*8);
 
@@ -2390,6 +2387,11 @@
                 if(s2->picture_structure == PICT_BOTTOM_FIELD)
                     mb_y++;
 
+                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;
+                }
+
                 if(s2->last_picture_ptr==NULL){
                 /* Skip B-frames if we do not have reference frames and gop is not closed */
                     if(s2->pict_type==FF_B_TYPE){