From 704a3d0a1fa83ef2ab061cf334fa4ef48bf8e7a1 Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 3 Aug 2022 15:22:20 -0700 Subject: [PATCH] dsp/lossless.c: quiet int sanitizer warnings in calls to Clip255(); given the current implementation's use of a logical shift the parameter is left as uint32_t and explicit casts are added clears warnings of the form: src/dsp/lossless.c:52:18: runtime error: implicit conversion from type 'int' of value -2 (32-bit, signed) to type 'uint32_t' (aka 'unsigned int') changed the value to 4294967294 (32-bit, unsigned) Bug: b/229626362 Change-Id: If8a7f145c2d7e62e572e221da36b04281ed5c9bf --- src/dsp/lossless.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dsp/lossless.c b/src/dsp/lossless.c index 84a54296..4e399923 100644 --- a/src/dsp/lossless.c +++ b/src/dsp/lossless.c @@ -49,7 +49,7 @@ static WEBP_INLINE uint32_t Clip255(uint32_t a) { } static WEBP_INLINE int AddSubtractComponentFull(int a, int b, int c) { - return Clip255(a + b - c); + return Clip255((uint32_t)(a + b - c)); } static WEBP_INLINE uint32_t ClampedAddSubtractFull(uint32_t c0, uint32_t c1, @@ -66,7 +66,7 @@ static WEBP_INLINE uint32_t ClampedAddSubtractFull(uint32_t c0, uint32_t c1, } static WEBP_INLINE int AddSubtractComponentHalf(int a, int b) { - return Clip255(a + (a - b) / 2); + return Clip255((uint32_t)(a + (a - b) / 2)); } static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1,