utils.h,WEBP_ALIGN: make bitmask unsigned

this fixes runtime warnings with clang -fsanitize=integer when using the
WEBP_ALIGN_CST constant in WEBP_ALIGN:
implicit conversion from type 'int' of value -32 (32-bit, signed) to
type 'unsigned int' changed the value to 4294967264 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I524d80e620b9869de4e6d322b7de6ffa1ec8657f
This commit is contained in:
James Zern 2022-07-29 12:23:10 -07:00
parent 748e92bbb9
commit c151e95bdc

View File

@ -64,7 +64,8 @@ WEBP_EXTERN void WebPSafeFree(void* const ptr);
// Alignment // Alignment
#define WEBP_ALIGN_CST 31 #define WEBP_ALIGN_CST 31
#define WEBP_ALIGN(PTR) (((uintptr_t)(PTR) + WEBP_ALIGN_CST) & ~WEBP_ALIGN_CST) #define WEBP_ALIGN(PTR) (((uintptr_t)(PTR) + WEBP_ALIGN_CST) & \
~(uintptr_t)WEBP_ALIGN_CST)
#include <string.h> #include <string.h>
// memcpy() is the safe way of moving potentially unaligned 32b memory. // memcpy() is the safe way of moving potentially unaligned 32b memory.