summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-11-01 14:48:50 -0400
committerAdam Jackson <ajax@nwnk.net>2019-11-13 20:00:20 +0000
commit47bec681d98007aa1303ed847b632f08be0582a1 (patch)
treebad710fd3099ba31cd396b1d6092f57312d81e9d
parentbaed75faa988a39295c79e71932f26de68904eea (diff)
downloadpixman-47bec681d98007aa1303ed847b632f08be0582a1.tar.gz
pixman-mmx: Fix undefined unaligned loads
-rw-r--r--pixman/pixman-mmx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index df30581..d7cf265 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -387,8 +387,10 @@ in_over (__m64 src, __m64 srca, __m64 mask, __m64 dest)
static force_inline __m64 ldq_u(__m64 *p)
{
#ifdef USE_X86_MMX
- /* x86's alignment restrictions are very relaxed. */
- return *(__m64 *)p;
+ /* x86's alignment restrictions are very relaxed, but that's no excuse */
+ __m64 r;
+ memcpy(&r, p, sizeof(__m64));
+ return r;
#elif defined USE_ARM_IWMMXT
int align = (uintptr_t)p & 7;
__m64 *aligned_p;
@@ -407,7 +409,9 @@ static force_inline uint32_t ldl_u(const uint32_t *p)
{
#ifdef USE_X86_MMX
/* x86's alignment restrictions are very relaxed. */
- return *p;
+ uint32_t r;
+ memcpy(&r, p, sizeof(uint32_t));
+ return r;
#else
struct __una_u32 { uint32_t x __attribute__((packed)); };
const struct __una_u32 *ptr = (const struct __una_u32 *) p;