error_concealment: Check that the picture is not in a half setup state.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 11 Jan 2013 03:44:20 +0000 (04:44 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 19 Jan 2013 15:18:01 +0000 (16:18 +0100)
Fixes state becoming inconsistent
Fixes a null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 23318a57358358e7a4dc551e830e4503f0638cfe)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/error_resilience.c

index 01f7424..2b6bc42 100644 (file)
@@ -924,6 +924,12 @@ void ff_er_frame_end(MpegEncContext *s)
         return;
     };
 
+    if (   s->picture_structure == PICT_FRAME
+        && s->current_picture.f.linesize[0] != s->current_picture_ptr->f.linesize[0]) {
+        av_log(s->avctx, AV_LOG_ERROR, "Error concealment not possible, frame not fully initialized\n");
+        return;
+    }
+
     if (s->current_picture.f.motion_val[0] == NULL) {
         av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");