[FFmpeg-cvslog] ratecontrol: Fix assertion failure on mismatching 2pass file.

Michael Niedermayer git at videolan.org
Sat Nov 24 03:21:27 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Nov 24 03:03:17 2012 +0100| [f1470ca685026df163c3af9c844231c650472193] | committer: Michael Niedermayer

ratecontrol: Fix assertion failure on mismatching 2pass file.

Fixes Ticket582

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1470ca685026df163c3af9c844231c650472193
---

 libavcodec/ratecontrol.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index d1a9a58..59f69a2 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_number<rcc->num_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{



More information about the ffmpeg-cvslog mailing list