From 4f857bacd22ea4e95c0bd8a0de3da3dcd017eff3 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Thu, 27 Mar 2014 12:54:06 -0700 Subject: [BITSTREAM]Fix the scaling calculation For very large size video image, the scaling calculation may need use value beyond the range of int. This commit upgrade the value to 64bit to make sure the calculation do not wrap around INT_MAX. The change corrected the decoder behavior. The bug affects only very large resolution video because the scaling calculation was sufficient for image size smaller than 2^13. This resolves issue: https://code.google.com/p/webm/issues/detail?id=750 Change-Id: I2d2ed303ca6482f31f819f3c07d6d3e98ef3adc5 --- vp9/common/vp9_scale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vp9/common/vp9_scale.c') diff --git a/vp9/common/vp9_scale.c b/vp9/common/vp9_scale.c index e0f1e3410..d3405fcdb 100644 --- a/vp9/common/vp9_scale.c +++ b/vp9/common/vp9_scale.c @@ -13,11 +13,11 @@ #include "vp9/common/vp9_scale.h" static INLINE int scaled_x(int val, const struct scale_factors *sf) { - return val * sf->x_scale_fp >> REF_SCALE_SHIFT; + return (int)((int64_t)val * sf->x_scale_fp >> REF_SCALE_SHIFT); } static INLINE int scaled_y(int val, const struct scale_factors *sf) { - return val * sf->y_scale_fp >> REF_SCALE_SHIFT; + return (int)((int64_t)val * sf->y_scale_fp >> REF_SCALE_SHIFT); } static int unscaled_value(int val, const struct scale_factors *sf) { -- cgit v1.2.3