1 |
commit: f6e0b2dea97f6b8f437b32c0602d654dac8fb64c |
2 |
Author: Sebastian Pipping <sping <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 21 19:56:03 2017 +0000 |
4 |
Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 21 19:57:53 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6e0b2de |
7 |
|
8 |
media-gfx/optipng: CVE-2017-1000229 |
9 |
|
10 |
Package-Manager: Portage-2.3.10, Repoman-2.3.3 |
11 |
|
12 |
.../files/optipng-0.7.6-cve-2017-1000229.patch | 25 ++++++++++ |
13 |
media-gfx/optipng/optipng-0.7.6-r1.ebuild | 56 ++++++++++++++++++++++ |
14 |
2 files changed, 81 insertions(+) |
15 |
|
16 |
diff --git a/media-gfx/optipng/files/optipng-0.7.6-cve-2017-1000229.patch b/media-gfx/optipng/files/optipng-0.7.6-cve-2017-1000229.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..19dc3ad0c57 |
19 |
--- /dev/null |
20 |
+++ b/media-gfx/optipng/files/optipng-0.7.6-cve-2017-1000229.patch |
21 |
@@ -0,0 +1,25 @@ |
22 |
+From 77ac8e9fd9b2c1aeec3951e2bb50f7cc2c1e92d2 Mon Sep 17 00:00:00 2001 |
23 |
+From: Sebastian Pipping <sebastian@×××××××.org> |
24 |
+Date: Sun, 19 Nov 2017 16:04:26 +0100 |
25 |
+Subject: [PATCH] Prevent integer overflow (bug #65, CVE-2017-1000229) |
26 |
+ |
27 |
+--- |
28 |
+ src/minitiff/tiffread.c | 2 ++ |
29 |
+ 1 file changed, 2 insertions(+) |
30 |
+ |
31 |
+diff --git a/src/minitiff/tiffread.c b/src/minitiff/tiffread.c |
32 |
+index b4910ec..5f9b376 100644 |
33 |
+--- a/src/minitiff/tiffread.c |
34 |
++++ b/src/minitiff/tiffread.c |
35 |
+@@ -350,6 +350,8 @@ minitiff_read_info(struct minitiff_info *tiff_ptr, FILE *fp) |
36 |
+ count = tiff_ptr->strip_offsets_count; |
37 |
+ if (count == 0 || count > tiff_ptr->height) |
38 |
+ goto err_invalid; |
39 |
++ if (count > (size_t)-1 / sizeof(long)) |
40 |
++ goto err_memory; |
41 |
+ tiff_ptr->strip_offsets = (long *)malloc(count * sizeof(long)); |
42 |
+ if (tiff_ptr->strip_offsets == NULL) |
43 |
+ goto err_memory; |
44 |
+-- |
45 |
+2.14.2 |
46 |
+ |
47 |
|
48 |
diff --git a/media-gfx/optipng/optipng-0.7.6-r1.ebuild b/media-gfx/optipng/optipng-0.7.6-r1.ebuild |
49 |
new file mode 100644 |
50 |
index 00000000000..becde449ea4 |
51 |
--- /dev/null |
52 |
+++ b/media-gfx/optipng/optipng-0.7.6-r1.ebuild |
53 |
@@ -0,0 +1,56 @@ |
54 |
+# Copyright 1999-2017 Gentoo Foundation |
55 |
+# Distributed under the terms of the GNU General Public License v2 |
56 |
+ |
57 |
+EAPI=4 |
58 |
+ |
59 |
+inherit eutils toolchain-funcs |
60 |
+ |
61 |
+DESCRIPTION="Compress PNG files without affecting image quality" |
62 |
+HOMEPAGE="http://optipng.sourceforge.net/" |
63 |
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" |
64 |
+ |
65 |
+LICENSE="ZLIB" |
66 |
+SLOT="0" |
67 |
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris" |
68 |
+IUSE="" |
69 |
+ |
70 |
+RDEPEND="sys-libs/zlib |
71 |
+ media-libs/libpng:0" |
72 |
+DEPEND="${RDEPEND} |
73 |
+ sys-apps/findutils" |
74 |
+ |
75 |
+src_prepare() { |
76 |
+ epatch "${FILESDIR}"/${PN}-0.7.5-estonian.patch |
77 |
+ epatch "${FILESDIR}"/${PN}-0.7.6-cve-2017-1000229.patch # bug 637936 |
78 |
+ |
79 |
+ rm -R src/{libpng,zlib} || die |
80 |
+ find . -type d -name build -exec rm -R {} + || die |
81 |
+ |
82 |
+ # next release is almost a complete rewrite, so plug this compilation |
83 |
+ # problem in anticipation of the much (c)leaner(?) rewrite |
84 |
+ sed -i \ |
85 |
+ -e 's/^#ifdef AT_FDCWD/#if defined(AT_FDCWD) \&\& !(defined (__SVR4) \&\& defined (__sun))/' \ |
86 |
+ src/optipng/osys.c || die |
87 |
+ |
88 |
+ tc-export CC AR RANLIB |
89 |
+ export LD=$(tc-getCC) |
90 |
+} |
91 |
+ |
92 |
+src_configure() { |
93 |
+ ./configure \ |
94 |
+ -with-system-libpng \ |
95 |
+ -with-system-zlib \ |
96 |
+ || die "configure failed" |
97 |
+} |
98 |
+ |
99 |
+src_compile() { |
100 |
+ emake -C src/optipng |
101 |
+} |
102 |
+ |
103 |
+src_install() { |
104 |
+ dodoc README.txt doc/*.txt |
105 |
+ dohtml doc/*.html |
106 |
+ doman src/${PN}/man/${PN}.1 |
107 |
+ |
108 |
+ dobin src/${PN}/${PN} |
109 |
+} |