utils.h: quiet -fsanitize=undefined warnings

add WEBP_UBSAN_IGNORE_UNDEF to WebPMemToUint32() / WebPUint32ToMem()
when WEBP_FORCE_ALIGNED is unset

Change-Id: I726b2e708ce29681584eb10c8874d5cf1e798756
This commit is contained in:
James Zern 2016-05-11 23:44:32 -07:00
parent ea0be354a0
commit af81fdb772

View File

@ -21,6 +21,7 @@
#include <assert.h> #include <assert.h>
#include "../dsp/dsp.h"
#include "../webp/types.h" #include "../webp/types.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -65,10 +66,12 @@ static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) {
memcpy(ptr, &val, sizeof(val)); memcpy(ptr, &val, sizeof(val));
} }
#else #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; 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; *(uint32_t*)ptr = val;
} }
#endif #endif