icedove (3.0.11-1+squeeze6) 0057-Fix-unaligned-reads-in-qcms.patch

Summary

 mozilla/gfx/qcms/iccread.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

    
download this patch

Patch contents

From: Vladimir Vukicevic <vladimir@pobox.com>
Date: Tue, 8 Sep 2009 11:36:28 -0400
Subject: [PATCH] Fix unaligned reads in qcms

https://bugzilla.mozilla.org/show_bug.cgi?id=504766
---
 mozilla/gfx/qcms/iccread.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/mozilla/gfx/qcms/iccread.c b/mozilla/gfx/qcms/iccread.c
index 7cc5d7f..6671c73 100644
--- a/mozilla/gfx/qcms/iccread.c
+++ b/mozilla/gfx/qcms/iccread.c
@@ -87,7 +87,9 @@ static uint32_t read_u32(struct mem_source *mem, size_t offset)
 		invalid_source(mem, "Invalid offset");
 		return 0;
 	} else {
-		return be32_to_cpu(*(__be32*)(mem->buf + offset));
+		__be32 k;
+		memcpy(&k, mem->buf + offset, sizeof(__be32));
+		return be32_to_cpu(k);
 	}
 }
 
@@ -97,7 +99,9 @@ static uint16_t read_u16(struct mem_source *mem, size_t offset)
 		invalid_source(mem, "Invalid offset");
 		return 0;
 	} else {
-		return be16_to_cpu(*(__be16*)(mem->buf + offset));
+		__be16 k;
+		memcpy(&k, mem->buf + offset, sizeof(__be16));
+		return be16_to_cpu(k);
 	}
 }
 
--