blob: 4f3b27faf0234e9adc7035fa6950c1efa0653d1a (
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.2 2010/07/12 16:49:22 tnn Exp $
# reported upstream as
# https://bugzilla.mozilla.org/show_bug.cgi?id=514002
--- mozilla/gfx/qcms/iccread.c.orig 2009-07-30 17:30:16.000000000 +0200
+++ mozilla/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);
}
}
|