From 5037220e55babc749689c1ff6e31f2f17ebe3f8c Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 5 Aug 2022 22:12:59 -0700 Subject: [PATCH] VP8LSubtractGreenFromBlueAndRed_C: clear int sanitizer warnings previously the types were changed to int to prevent unsigned overflow warnings: 6ab496ed fix some 'unsigned integer overflow' warnings in ubsan clears warnings of the form: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 3724541952 (32-bit, unsigned) to type 'int' changed the value to -570425344 (32-bit, signed) implicit conversion from type 'int' of value -3361661 (32-bit, signed) to type 'unsigned int' changed the value to 4291605635 (32-bit, unsigned) Bug: b/229626362 Change-Id: If1eb39c5dd7218d686c3c47fb7df72431b873be4 --- src/dsp/lossless_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dsp/lossless_enc.c b/src/dsp/lossless_enc.c index de6c4ace..9ac2e443 100644 --- a/src/dsp/lossless_enc.c +++ b/src/dsp/lossless_enc.c @@ -522,11 +522,11 @@ static void GetCombinedEntropyUnrefined_C(const uint32_t X[], void VP8LSubtractGreenFromBlueAndRed_C(uint32_t* argb_data, int num_pixels) { int i; for (i = 0; i < num_pixels; ++i) { - const int argb = argb_data[i]; + const int argb = (int)argb_data[i]; const int green = (argb >> 8) & 0xff; const uint32_t new_r = (((argb >> 16) & 0xff) - green) & 0xff; const uint32_t new_b = (((argb >> 0) & 0xff) - green) & 0xff; - argb_data[i] = (argb & 0xff00ff00u) | (new_r << 16) | new_b; + argb_data[i] = ((uint32_t)argb & 0xff00ff00u) | (new_r << 16) | new_b; } }