Fix an unaligned access on sparc64 leading to random crashes when

mozilla tries to read a malformed ICC profile on random image content
found on the web.
backport of http://hg.mozilla.org/mozilla-central/rev/e8207773d54d
ref: https://bugzilla.mozilla.org/show_bug.cgi?id=629057
issue reported and fix found by naddy@
ok naddy@ ajacoutot@
This commit is contained in:
landry 2011-01-28 21:38:12 +00:00
parent 373155557e
commit 1c74338058
11 changed files with 153 additions and 13 deletions

View File

@ -1,12 +1,12 @@
# $OpenBSD: Makefile,v 1.36 2011/01/18 12:37:44 landry Exp $
# $OpenBSD: Makefile,v 1.37 2011/01/28 21:38:12 landry Exp $
MOZILLA_VERSION = 1.9.2.13
FFX_VERSION = 3.6.13
MOZILLA_BRANCH = 1.9.2
MOZILLA_PROJECT = xulrunner1.9
DISTNAME = firefox-${FFX_VERSION}.source
REVISION-main = 2
REVISION-devel = 1
REVISION-main = 3
REVISION-devel = 2
MASTER_SITES = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${FFX_VERSION}/source/

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.116 2011/01/18 12:37:44 landry Exp $
# $OpenBSD: Makefile,v 1.117 2011/01/28 21:38:12 landry Exp $
COMMENT-main = Mozilla e-mail, rss and usenet client
COMMENT-lightning = Mozilla Thunderbird calendar extension
@ -12,7 +12,7 @@ MOZILLA_CODENAME = mail
MULTI_PACKAGES = -main -lightning
PKGNAME-main = ${PKGNAME}
REVISION-main = 2
REVISION-main = 3
PKGNAME-lightning = lightning-1.0beta2
EPOCH-lightning = 0
REVISION-lightning = 13

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-mozilla_gfx_qcms_iccread_c,v 1.1 2011/01/28 21:38:12 landry Exp $
Fix crash on sparc64
https://bugzilla.mozilla.org/show_bug.cgi?id=629057
http://hg.mozilla.org/mozilla-central/rev/e8207773d54d
--- mozilla/gfx/qcms/iccread.c.orig Tue Dec 7 17:35:40 2010
+++ mozilla/gfx/qcms/iccread.c Thu Jan 27 23:37:33 2011
@@ -87,7 +87,9 @@ static uint32_t read_u32(struct mem_source *mem, size_
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_
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);
}
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.21 2011/01/18 12:37:44 landry Exp $
# $OpenBSD: Makefile,v 1.22 2011/01/28 21:38:12 landry Exp $
COMMENT = Mozilla calendar
@ -8,7 +8,7 @@ MOZILLA_BRANCH = 1.9.1
MOZILLA_CODENAME = calendar
DISTNAME = lightning-sunbird-1.0b1.source
REVISION = 10
REVISION = 11
EPOCH = 0
CATEGORIES = productivity mail

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-mozilla_gfx_qcms_iccread_c,v 1.1 2011/01/28 21:38:12 landry Exp $
Fix crash on sparc64
https://bugzilla.mozilla.org/show_bug.cgi?id=629057
http://hg.mozilla.org/mozilla-central/rev/e8207773d54d
--- mozilla/gfx/qcms/iccread.c.orig Tue Dec 7 17:35:40 2010
+++ mozilla/gfx/qcms/iccread.c Thu Jan 27 23:37:33 2011
@@ -87,7 +87,9 @@ static uint32_t read_u32(struct mem_source *mem, size_
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_
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);
}
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.58 2011/01/18 12:37:44 landry Exp $
# $OpenBSD: Makefile,v 1.59 2011/01/28 21:38:12 landry Exp $
COMMENT = Mozilla web browser
@ -6,7 +6,7 @@ MOZILLA_VERSION = 3.5.16
MOZILLA_BRANCH = 1.9.1
MOZILLA_PROJECT = firefox35
MOZILLA_CODENAME = browser
REVISION = 1
REVISION = 2
SO_VERSION = 24.0
# NOTE: Must bump minor version if any shlib's are removed from the

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-gfx_qcms_iccread_c,v 1.1 2011/01/28 21:38:12 landry Exp $
Fix crash on sparc64
https://bugzilla.mozilla.org/show_bug.cgi?id=629057
http://hg.mozilla.org/mozilla-central/rev/e8207773d54d
--- gfx/qcms/iccread.c.orig Tue Nov 30 14:49:19 2010
+++ gfx/qcms/iccread.c Thu Jan 27 23:31:50 2011
@@ -87,7 +87,9 @@ static uint32_t read_u32(struct mem_source *mem, size_
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_
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);
}
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.165 2011/01/18 12:33:38 landry Exp $
# $OpenBSD: Makefile,v 1.166 2011/01/28 21:38:12 landry Exp $
COMMENT = Mozilla web browser
@ -7,7 +7,7 @@ MOZILLA_VERSION = 3.6.13
MOZILLA_BRANCH = 1.9.2
MOZILLA_PROJECT = mozilla-firefox
MOZILLA_CODENAME = browser
REVISION = 2
REVISION = 3
SO_VERSION = 22.2
# NOTE: Must bump minor version if any shlib's are removed from the

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-gfx_qcms_iccread_c,v 1.1 2011/01/28 21:38:12 landry Exp $
Fix crash on sparc64
https://bugzilla.mozilla.org/show_bug.cgi?id=629057
http://hg.mozilla.org/mozilla-central/rev/e8207773d54d
--- gfx/qcms/iccread.c.orig Fri Dec 3 16:48:03 2010
+++ gfx/qcms/iccread.c Thu Jan 27 23:43:43 2011
@@ -87,7 +87,9 @@ static uint32_t read_u32(struct mem_source *mem, size_
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_
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);
}
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.72 2011/01/18 12:37:44 landry Exp $
# $OpenBSD: Makefile,v 1.73 2011/01/28 21:38:12 landry Exp $
COMMENT-main = Mozilla application suite
COMMENT-lightning = Mozilla Seamonkey calendar extension
@ -10,7 +10,7 @@ MOZILLA_CODENAME = suite
MULTI_PACKAGES = -main -lightning
PKGNAME-main = ${PKGNAME}
REVISION-main = 2
REVISION-main = 3
PKGNAME-lightning = lightning-seamonkey-1.0beta1
REVISION-lightning = 13
EPOCH-lightning = 0

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-mozilla_gfx_qcms_iccread_c,v 1.1 2011/01/28 21:38:12 landry Exp $
Fix crash on sparc64
https://bugzilla.mozilla.org/show_bug.cgi?id=629057
http://hg.mozilla.org/mozilla-central/rev/e8207773d54d
--- mozilla/gfx/qcms/iccread.c.orig Tue Dec 7 17:35:40 2010
+++ mozilla/gfx/qcms/iccread.c Thu Jan 27 23:37:33 2011
@@ -87,7 +87,9 @@ static uint32_t read_u32(struct mem_source *mem, size_
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_
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);
}
}