diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index d1a9a582fd..59f69a27a8 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -691,7 +691,10 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) if(s->flags&CODEC_FLAG_PASS2){ assert(picture_number>=0); - assert(picture_numbernum_entries); + if(picture_number >= rcc->num_entries) { + av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); + return -1; + } rce= &rcc->entry[picture_number]; wanted_bits= rce->expected_bits; }else{