summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-11-24 00:15:49 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-11-24 00:15:49 +0000
commit6db2583c4f1013f2c1772507d0443dbe1c48b519 (patch)
treecd856035f3eea66ffe805d35e58dfe3162adc2ec /libavcodec/mpegvideo.c
parent80516d720ae2a9e8d01a83deb475f85c4c29e6df (diff)
check num_entries too to avoid reading over the array end and dont check i>0 it must be >0 there
Originally committed as revision 3708 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 3b097e1dff..47d7a9635d 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2014,16 +2014,16 @@ static void select_input_picture(MpegEncContext *s){
if(s->flags&CODEC_FLAG_PASS2){
for(i=0; i<s->max_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;
}
}