From 641fbb5e89d19620b0c135ea5ed8f4a9a6620ef0 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Mon, 9 Jul 2018 17:33:44 -0700 Subject: [PATCH] fix endian problems in pattern copy CopyBlock8b() was over-using memcpy() of 16b values. BUG=webp:393,webp:512 Change-Id: Id56f10d334b9a453fbcf50dabfaa63529bcff7e5 (cherry picked from commit 211f37ee633aa31c37160c84cc9b868c10fbe8b9) (cherry picked from commit 667d17a8a403e0768cccf585455cf12807cd1604) --- src/dec/vp8l_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dec/vp8l_dec.c b/src/dec/vp8l_dec.c index 42ea3b5e..39967d55 100644 --- a/src/dec/vp8l_dec.c +++ b/src/dec/vp8l_dec.c @@ -884,7 +884,11 @@ static WEBP_INLINE void CopyBlock8b(uint8_t* const dst, int dist, int length) { #endif break; case 2: +#if !defined(WORDS_BIGENDIAN) memcpy(&pattern, src, sizeof(uint16_t)); +#else + pattern = ((uint32_t)src[0] << 8) | src[1]; +#endif #if defined(__arm__) || defined(_M_ARM) pattern |= pattern << 16; #elif defined(WEBP_USE_MIPS_DSP_R2)