shithub: libvpx

Download patch

ref: 4c4d7261e43c27a2f44c522b5055f3e1ec21eea3
parent: b43c27ab6eccc1fff2de4e0dde25c0f495961439
author: Frank Galligan <fgalligan@google.com>
date: Thu Dec 4 11:26:47 EST 2014

Fix potential integer overflow.

ioc found a potential integer overflow in the rate control.

This is related to https://code.google.com/p/webm/issues/detail?id=821

Change-Id: Ib6c4acd6e964972f932fce7490592eb134f2b7ea

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -426,8 +426,8 @@
   }
   // Work out a size correction factor.
   if (projected_size_based_on_q > FRAME_OVERHEAD_BITS)
-    correction_factor = (100 * cpi->rc.projected_frame_size) /
-                            projected_size_based_on_q;
+    correction_factor = (int)((100 * (int64_t)cpi->rc.projected_frame_size) /
+                        projected_size_based_on_q);
 
   // More heavily damped adjustment used if we have been oscillating either side
   // of target.