# HG changeset patch # User michael # Date 1101255349 0 # Node ID f8a229dfa2e847eb3c48b9e59e4c9d71af9b6919 # Parent e0bda0b8359ab9504414178d529754ce2b8b2169 check num_entries too to avoid reading over the array end and dont check i>0 it must be >0 there diff -r e0bda0b8359a -r f8a229dfa2e8 mpegvideo.c --- a/mpegvideo.c Tue Nov 23 23:58:54 2004 +0000 +++ b/mpegvideo.c Wed Nov 24 00:15:49 2004 +0000 @@ -2014,16 +2014,16 @@ if(s->flags&CODEC_FLAG_PASS2){ for(i=0; imax_b_frames+1; i++){ int pict_num= s->input_picture[0]->display_picture_number + i; - int pict_type= s->rc_context.entry[pict_num].new_pict_type; - + + if(pict_num >= s->rc_context.num_entries) + break; if(!s->input_picture[i]){ - if(i>0) - s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; + s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; break; } - s->input_picture[i]->pict_type= pict_type; - - if(i + 1 >= s->rc_context.num_entries) break; + + s->input_picture[i]->pict_type= + s->rc_context.entry[pict_num].new_pict_type; } }