summaryrefslogtreecommitdiff
path: root/www/firefox/patches/patch-nd
blob: e07409ddc232c423beae0f25b25e2dca82af6075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$NetBSD: patch-nd,v 1.1 2009/09/01 20:36:19 martin Exp $

# reported upstream as
#   https://bugzilla.mozilla.org/show_bug.cgi?id=514002

--- gfx/qcms/iccread.c.orig	2009-07-30 17:30:16.000000000 +0200
+++ gfx/qcms/iccread.c	2009-09-01 21:29:29.000000000 +0200
@@ -23,6 +23,7 @@
 #include <math.h>
 #include <assert.h>
 #include <stdlib.h>
+#include <string.h>
 #include "qcmsint.h"
 
 //XXX: use a better typename
@@ -84,7 +85,9 @@ static uint32_t read_u32(struct mem_sour
 		invalid_source(mem, "Invalid offset");
 		return 0;
 	} else {
-		return be32_to_cpu(*(__be32*)(mem->buf + offset));
+		uint32_t v;
+		memcpy(&v, mem->buf + offset, 4);
+		return be32_to_cpu(v);
 	}
 }
 
@@ -94,7 +97,9 @@ static uint16_t read_u16(struct mem_sour
 		invalid_source(mem, "Invalid offset");
 		return 0;
 	} else {
-		return be16_to_cpu(*(__be16*)(mem->buf + offset));
+		uint16_t v;
+		memcpy(&v, mem->buf + offset, 2);
+		return be16_to_cpu(v);
 	}
 }