From d697b89baba6df9b72d8c03dfdd5952fb05e2b6a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 22 Apr 2002 21:02:18 +0000 Subject: [PATCH] segfault fix Originally committed as revision 418 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h263.c | 9 +++++++-- libavcodec/mpegvideo.c | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 7e3fec5181..2694f96808 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -359,8 +359,13 @@ void mpeg4_encode_mb(MpegEncContext * s, uint8_t *p_pic= s->new_picture[0] + offset; s->mb_skiped=1; for(i=0; imax_b_frames; i++){ - uint8_t *b_pic= s->coded_order[i+1].picture[0] + offset; - int diff= pix_abs16x16(p_pic, b_pic, s->linesize); + uint8_t *b_pic; + int diff; + + if(s->coded_order[i+1].pict_type!=B_TYPE) break; + + b_pic= s->coded_order[i+1].picture[0] + offset; + diff= pix_abs16x16(p_pic, b_pic, s->linesize); if(diff>s->qscale*70){ s->mb_skiped=0; break; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index ec1c0f9f05..c1a2cf746a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -645,6 +645,7 @@ void reorder_input(MpegEncContext *s, AVPicture *pict) s->coded_order[j]= s->coded_order[j+1]; } s->coded_order[j].picture[0]= s->coded_order[j].picture[1]= s->coded_order[j].picture[2]= NULL; //catch uninitalized buffers + s->coded_order[j].pict_type=0; switch(s->input_pict_type){ default: