fixed segfault if sequence header has not been found before slice decoding
authorFabrice Bellard <fabrice@bellard.org>
Mon, 16 Jun 2003 14:09:18 +0000 (14:09 +0000)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 16 Jun 2003 14:09:18 +0000 (14:09 +0000)
Originally committed as revision 1964 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mpeg12.c

index c31a711..c68f8d8 100644 (file)
@@ -1990,6 +1990,9 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
     Mpeg1Context *s1 = avctx->priv_data;
     MpegEncContext *s = &s1->mpeg_enc_ctx;
        
+    if (!s1->mpeg_enc_ctx_allocated)
+        return 0;
+
     /* end of slice reached */
     if (/*s->mb_y<<field_pic == s->mb_height &&*/ !s->first_field) {
         /* end of image */