From: Fiona Glaser Date: Sat, 19 Sep 2009 16:50:59 +0000 (-0700) Subject: Fix integer overflow in 2-pass VBV X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e6650e9b523db04fa916af69bf5cfaa9fee6c4e;p=libx264 Fix integer overflow in 2-pass VBV Bug caused slight undersizing in 2-pass mode in some cases. --- diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index c6b9f6d2..72d3c372 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -1936,7 +1936,7 @@ static int vbv_pass2( x264_t *h ) adj_max = fix_underflow(h, t0, t1, 1.001, qscale_min, qscale_max); expected_bits = count_expected_bits(h); - } while((expected_bits < .995*all_available_bits) && ((int)(expected_bits+.5) > (int)(prev_bits+.5)) ); + } while((expected_bits < .995*all_available_bits) && ((int64_t)(expected_bits+.5) > (int64_t)(prev_bits+.5)) ); if (!adj_max) x264_log( h, X264_LOG_WARNING, "vbv-maxrate issue, qpmax or vbv-maxrate too low\n");