Avoid segfault on ffmpeg "buffer flush" in mpeg12.c patch by (Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>)

Originally committed as revision 3324 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Wolfram Gloger 2004-07-16 18:36:39 +00:00 committed by Michael Niedermayer
parent 6206f8c920
commit 6cfe51d9da
1 changed files with 7 additions and 5 deletions

View File

@ -2769,12 +2769,14 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
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;
}