Mercurial > libavcodec.hg
comparison mpegvideo.c @ 2364:f8a229dfa2e8 libavcodec
check num_entries too to avoid reading over the array end and dont check i>0 it must be >0 there
| author | michael |
|---|---|
| date | Wed, 24 Nov 2004 00:15:49 +0000 |
| parents | e0bda0b8359a |
| children | 26560d4fdb1f |
comparison
equal
deleted
inserted
replaced
| 2363:e0bda0b8359a | 2364:f8a229dfa2e8 |
|---|---|
| 2012 int b_frames; | 2012 int b_frames; |
| 2013 | 2013 |
| 2014 if(s->flags&CODEC_FLAG_PASS2){ | 2014 if(s->flags&CODEC_FLAG_PASS2){ |
| 2015 for(i=0; i<s->max_b_frames+1; i++){ | 2015 for(i=0; i<s->max_b_frames+1; i++){ |
| 2016 int pict_num= s->input_picture[0]->display_picture_number + i; | 2016 int pict_num= s->input_picture[0]->display_picture_number + i; |
| 2017 int pict_type= s->rc_context.entry[pict_num].new_pict_type; | 2017 |
| 2018 | 2018 if(pict_num >= s->rc_context.num_entries) |
| 2019 break; | |
| 2019 if(!s->input_picture[i]){ | 2020 if(!s->input_picture[i]){ |
| 2020 if(i>0) | 2021 s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; |
| 2021 s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; | |
| 2022 break; | 2022 break; |
| 2023 } | 2023 } |
| 2024 s->input_picture[i]->pict_type= pict_type; | 2024 |
| 2025 | 2025 s->input_picture[i]->pict_type= |
| 2026 if(i + 1 >= s->rc_context.num_entries) break; | 2026 s->rc_context.entry[pict_num].new_pict_type; |
| 2027 } | 2027 } |
| 2028 } | 2028 } |
| 2029 | 2029 |
| 2030 if(s->avctx->b_frame_strategy==0){ | 2030 if(s->avctx->b_frame_strategy==0){ |
| 2031 b_frames= s->max_b_frames; | 2031 b_frames= s->max_b_frames; |
