]> granicus.if.org Git - libvpx/commitdiff
Fix potential integer overflow.
authorFrank Galligan <fgalligan@google.com>
Fri, 5 Dec 2014 00:26:47 +0000 (16:26 -0800)
committerFrank Galligan <fgalligan@google.com>
Fri, 5 Dec 2014 16:02:12 +0000 (08:02 -0800)
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

vp9/encoder/vp9_ratectrl.c

index 37b6718bf0baff2e047aab7ee2989b680c06d41c..3cc9d9a7b90c1e353cb67db0fbc1809f3b50986c 100644 (file)
@@ -426,8 +426,8 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
   }
   // 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.