mpegvideo: Drop a faulty assert
authorLuca Barbato <lu_zero@gentoo.org>
Tue, 22 Oct 2013 17:17:10 +0000 (19:17 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Wed, 23 Oct 2013 08:49:48 +0000 (10:49 +0200)
That check is easily reachable by faulty input.

CC:libav-stable@libav.org
Reported-by: Torsten Sadowski <tsadowski@gmx.net>
libavcodec/mpegvideo.c

index 192e27f..718f946 100644 (file)
@@ -1633,8 +1633,12 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
             return ret;
     }
 
-    assert(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr &&
-                                                 s->last_picture_ptr->f.data[0]));
+    if (s->pict_type != AV_PICTURE_TYPE_I &&
+        !(s->last_picture_ptr && s->last_picture_ptr->f.data[0])) {
+        av_log(s, AV_LOG_ERROR,
+               "Non-reference picture received and no reference available\n");
+        return AVERROR_INVALIDDATA;
+    }
 
     if (s->picture_structure!= PICT_FRAME) {
         int i;