shithub: libvpx

Download patch

ref: b2fc3ca0669170874df84c4fda8347ce693826e2
parent: 0e36158c7064db3410bf269df14d7bbd9f6d8492
author: James Zern <jzern@google.com>
date: Mon Feb 25 08:00:18 EST 2013

vp9: promote gf_group_bits calculation to 64-bit

avoids signed integer overflow

Change-Id: I9ffcdba90b21edb324d1b173fd11d613e0592931

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1663,8 +1663,9 @@
 
   // Clip cpi->twopass.gf_group_bits based on user supplied data rate
   // variability limit (cpi->oxcf.two_pass_vbrmax_section)
-  if (cpi->twopass.gf_group_bits > max_bits * cpi->baseline_gf_interval)
-    cpi->twopass.gf_group_bits = max_bits * cpi->baseline_gf_interval;
+  if (cpi->twopass.gf_group_bits >
+      (int64_t)max_bits * cpi->baseline_gf_interval)
+    cpi->twopass.gf_group_bits = (int64_t)max_bits * cpi->baseline_gf_interval;
 
   // Reset the file position
   reset_fpf_position(cpi, start_pos);
--