Avoid segfault on ffmpeg "buffer flush" in mpeg12.c patch by (Wolfram Gloger <wmglo...
authorWolfram Gloger <wmglo@dent.med.uni-muenchen.de>
Fri, 16 Jul 2004 18:36:39 +0000 (18:36 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Jul 2004 18:36:39 +0000 (18:36 +0000)
Originally committed as revision 3324 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mpeg12.c

index 9acdd2e..5a2df29 100644 (file)
@@ -2769,12 +2769,14 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
     MpegEncContext *s2 = &s->mpeg_enc_ctx;
     dprintf("fill_buffer\n");
 
     MpegEncContext *s2 = &s->mpeg_enc_ctx;
     dprintf("fill_buffer\n");
 
-    /* special case for last picture */
-    if (buf_size == 0 && s2->low_delay==0 && s2->next_picture_ptr) {
-        *picture= *(AVFrame*)s2->next_picture_ptr;
-        s2->next_picture_ptr= NULL;
+    if (buf_size == 0) {
+       /* special case for last picture */
+       if (s2->low_delay==0 && s2->next_picture_ptr) {
+           *picture= *(AVFrame*)s2->next_picture_ptr;
+           s2->next_picture_ptr= NULL;
 
 
-        *data_size = sizeof(AVFrame);
+           *data_size = sizeof(AVFrame);
+       }
         return 0;
     }
 
         return 0;
     }