shithub: libvpx

Download patch

ref: a7059eca33bc3bac7e3b71e2099b2fc578230353
parent: e46820c693d0dc01685841cfc704c16dbac48e80
author: Hien Ho <hienho@google.com>
date: Fri Aug 9 12:33:57 EDT 2019

test/lpf_test: fix int sanitizer warning

runtime error: implicit conversion from type 'int' of value 65594 (32-bit, signed)
to type 'uint16_t' (aka 'unsigned short') changed the value to 58 (16-bit, unsigned)

BUG=webm:1615

Change-Id: I6046a4a4fc0a108c337153f2c59d5cef5c8dcbd6

--- a/test/lpf_test.cc
+++ b/test/lpf_test.cc
@@ -75,9 +75,9 @@
         if (j < 1) {
           tmp_s[j] = rnd->Rand16();
         } else if (val & 0x20) {  // Increment by a value within the limit.
-          tmp_s[j] = tmp_s[j - 1] + (limit - 1);
+          tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] + (limit - 1));
         } else {  // Decrement by a value within the limit.
-          tmp_s[j] = tmp_s[j - 1] - (limit - 1);
+          tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] - (limit - 1));
         }
         j++;
       }
@@ -94,11 +94,11 @@
         if (j < 1) {
           tmp_s[j] = rnd->Rand16();
         } else if (val & 0x20) {  // Increment by a value within the limit.
-          tmp_s[(j % 32) * 32 + j / 32] =
-              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1);
+          tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
+              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1));
         } else {  // Decrement by a value within the limit.
-          tmp_s[(j % 32) * 32 + j / 32] =
-              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1);
+          tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
+              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1));
         }
         j++;
       }