From 566f6d75bdbf6ad85e191017facbb642ccc4059b Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 24 May 2017 15:25:44 +0200 Subject: [PATCH] partial_idct_test,InitInput: fix rollover in mult promote coeff to signed 64-bit to avoid exceeding integer bounds when squaring the value Change-Id: If77bef6bc0a6a4c39ca3013e5e2ddb426a1c6e1f --- test/partial_idct_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc index babd7fcc2..c76308bbb 100644 --- a/test/partial_idct_test.cc +++ b/test/partial_idct_test.cc @@ -133,7 +133,7 @@ class PartialIDctTest : public ::testing::TestWithParam { for (int j = 0; j < last_nonzero_; ++j) { tran_low_t coeff = static_cast( sqrt(1.0 * max_energy_leftover) * (rnd_.Rand16() - 32768) / 65536); - max_energy_leftover -= coeff * coeff; + max_energy_leftover -= static_cast(coeff) * coeff; if (max_energy_leftover < 0) { max_energy_leftover = 0; coeff = 0; -- 2.40.0