From af81fdb7727d262913e33007ba583faf60f7a20f Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 11 May 2016 23:44:32 -0700 Subject: [PATCH] utils.h: quiet -fsanitize=undefined warnings add WEBP_UBSAN_IGNORE_UNDEF to WebPMemToUint32() / WebPUint32ToMem() when WEBP_FORCE_ALIGNED is unset Change-Id: I726b2e708ce29681584eb10c8874d5cf1e798756 --- src/utils/utils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/utils.h b/src/utils/utils.h index a18b4a2f..c6c10149 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -21,6 +21,7 @@ #include +#include "../dsp/dsp.h" #include "../webp/types.h" #ifdef __cplusplus @@ -65,10 +66,12 @@ static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { memcpy(ptr, &val, sizeof(val)); } #else -static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) { +static WEBP_UBSAN_IGNORE_UNDEF WEBP_INLINE +uint32_t WebPMemToUint32(const uint8_t* const ptr) { return *(const uint32_t*)ptr; } -static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { +static WEBP_UBSAN_IGNORE_UNDEF WEBP_INLINE +void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { *(uint32_t*)ptr = val; } #endif