WebPMemToUint32: remove ptr cast to int

this can result in an alignment hint on arm causing a SIGBUS. casting
the input ptr to anything aside from its type is unnecessary for memcpy
and is contrary to the intent of this function.

Change-Id: I9a4d3f4be90f80cd8c3e96ccbe557e51e34cf7a5
(cherry picked from commit 04b029d236)
This commit is contained in:
James Zern 2017-10-30 17:08:46 -07:00
parent 0af22e17d6
commit 88692490a5

View File

@ -66,7 +66,7 @@ WEBP_EXTERN(void) WebPSafeFree(void* const ptr);
// memcpy() is the safe way of moving potentially unaligned 32b memory. // memcpy() is the safe way of moving potentially unaligned 32b memory.
static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) { static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) {
uint32_t A; uint32_t A;
memcpy(&A, (const int*)ptr, sizeof(A)); memcpy(&A, ptr, sizeof(A));
return A; return A;
} }
static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) {