Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/tiff/files/, media-libs/tiff/
Date: Fri, 16 Feb 2018 15:30:52
Message-Id: 1518794493.88961c859ba1efbe6e3555246444dc0456bddcb8.polynomial-c@gentoo
1 commit: 88961c859ba1efbe6e3555246444dc0456bddcb8
2 Author: Michael Vetter <jubalh <AT> iodoru <DOT> org>
3 AuthorDate: Fri Feb 16 15:04:47 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 16 15:21:33 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88961c85
7
8 media-libs/tiff: Patch to fix type (CVE-2017-9935)
9
10 CVE-2017-9935 has a second commit with ID
11 d4f213636b6f950498a1386083199bd7f65676b9 to fix the type of the table.
12
13 Bug: https://bugs.gentoo.org/624696
14
15 Package-Manager: Portage-2.3.19, Repoman-2.3.6
16 Closes: https://github.com/gentoo/gentoo/pull/7204
17
18 ...ff-4.0.9-CVE-2017-9935-fix-incorrect-type.patch | 58 ++++++++++++++++
19 media-libs/tiff/tiff-4.0.9-r2.ebuild | 80 ++++++++++++++++++++++
20 2 files changed, 138 insertions(+)
21
22 diff --git a/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935-fix-incorrect-type.patch b/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935-fix-incorrect-type.patch
23 new file mode 100644
24 index 00000000000..101618ee7d5
25 --- /dev/null
26 +++ b/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935-fix-incorrect-type.patch
27 @@ -0,0 +1,58 @@
28 +From d4f213636b6f950498a1386083199bd7f65676b9 Mon Sep 17 00:00:00 2001
29 +From: Brian May <brian@×××××××××××××.xyz>
30 +Date: Thu, 7 Dec 2017 07:49:20 +1100
31 +Subject: [PATCH] tiff2pdf: Fix apparent incorrect type for transfer table
32 +
33 +The standard says the transfer table contains unsigned 16 bit values,
34 +I have no idea why we refer to them as floats.
35 +---
36 + tools/tiff2pdf.c | 12 ++++++------
37 + 1 file changed, 6 insertions(+), 6 deletions(-)
38 +
39 +diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
40 +index c3ec074..484776c 100644
41 +--- a/tools/tiff2pdf.c
42 ++++ b/tools/tiff2pdf.c
43 +@@ -237,7 +237,7 @@ typedef struct {
44 + float tiff_whitechromaticities[2];
45 + float tiff_primarychromaticities[6];
46 + float tiff_referenceblackwhite[2];
47 +- float* tiff_transferfunction[3];
48 ++ uint16* tiff_transferfunction[3];
49 + int pdf_image_interpolate; /* 0 (default) : do not interpolate,
50 + 1 : interpolate */
51 + uint16 tiff_transferfunctioncount;
52 +@@ -1048,7 +1048,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
53 + uint16 paged=0;
54 + uint16 xuint16=0;
55 + uint16 tiff_transferfunctioncount=0;
56 +- float* tiff_transferfunction[3];
57 ++ uint16* tiff_transferfunction[3];
58 +
59 + directorycount=TIFFNumberOfDirectories(input);
60 + t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_PAGE)));
61 +@@ -1153,8 +1153,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
62 + &(tiff_transferfunction[1]),
63 + &(tiff_transferfunction[2]))) {
64 +
65 +- if((tiff_transferfunction[1] != (float*) NULL) &&
66 +- (tiff_transferfunction[2] != (float*) NULL)
67 ++ if((tiff_transferfunction[1] != (uint16*) NULL) &&
68 ++ (tiff_transferfunction[2] != (uint16*) NULL)
69 + ) {
70 + tiff_transferfunctioncount=3;
71 + } else {
72 +@@ -1851,8 +1851,8 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
73 + &(t2p->tiff_transferfunction[0]),
74 + &(t2p->tiff_transferfunction[1]),
75 + &(t2p->tiff_transferfunction[2]))) {
76 +- if((t2p->tiff_transferfunction[1] != (float*) NULL) &&
77 +- (t2p->tiff_transferfunction[2] != (float*) NULL)
78 ++ if((t2p->tiff_transferfunction[1] != (uint16*) NULL) &&
79 ++ (t2p->tiff_transferfunction[2] != (uint16*) NULL)
80 + ) {
81 + t2p->tiff_transferfunctioncount=3;
82 + } else {
83 +--
84 +libgit2 0.26.0
85 +
86
87 diff --git a/media-libs/tiff/tiff-4.0.9-r2.ebuild b/media-libs/tiff/tiff-4.0.9-r2.ebuild
88 new file mode 100644
89 index 00000000000..aafbb887102
90 --- /dev/null
91 +++ b/media-libs/tiff/tiff-4.0.9-r2.ebuild
92 @@ -0,0 +1,80 @@
93 +# Copyright 1999-2018 Gentoo Foundation
94 +# Distributed under the terms of the GNU General Public License v2
95 +
96 +EAPI="6"
97 +inherit autotools eutils libtool multilib-minimal
98 +
99 +DESCRIPTION="Tag Image File Format (TIFF) library"
100 +HOMEPAGE="http://libtiff.maptools.org"
101 +SRC_URI="http://download.osgeo.org/libtiff/${P}.tar.gz
102 + ftp://ftp.remotesensing.org/pub/libtiff/${P}.tar.gz"
103 +
104 +LICENSE="libtiff"
105 +SLOT="0"
106 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris"
107 +IUSE="+cxx jbig jpeg lzma static-libs test zlib"
108 +
109 +RDEPEND="jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
110 + jbig? ( >=media-libs/jbigkit-2.1:=[${MULTILIB_USEDEP}] )
111 + lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] )
112 + zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] )
113 + abi_x86_32? (
114 + !<=app-emulation/emul-linux-x86-baselibs-20130224-r9
115 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
116 + )"
117 +DEPEND="${RDEPEND}"
118 +
119 +REQUIRED_USE="test? ( jpeg )" #483132
120 +
121 +PATCHES=(
122 + "${FILESDIR}"/${PN}-4.0.7-pdfium-0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch
123 + "${FILESDIR}"/${PN}-4.0.7-pdfium-0008-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch
124 + "${FILESDIR}"/${P}-CVE-2017-9935.patch #624696
125 + "${FILESDIR}"/${P}-CVE-2017-9935-fix-incorrect-type.patch #624696
126 +)
127 +
128 +MULTILIB_WRAPPED_HEADERS=(
129 + /usr/include/tiffconf.h
130 +)
131 +
132 +src_prepare() {
133 + default
134 +
135 + # tiffcp-thumbnail.sh fails as thumbnail binary doesn't get built anymore since tiff-4.0.7
136 + sed '/tiffcp-thumbnail\.sh/d' -i test/Makefile.am || die
137 +
138 + eautoreconf
139 +}
140 +
141 +multilib_src_configure() {
142 + ECONF_SOURCE="${S}" econf \
143 + $(use_enable static-libs static) \
144 + $(use_enable zlib) \
145 + $(use_enable jpeg) \
146 + $(use_enable jbig) \
147 + $(use_enable lzma) \
148 + $(use_enable cxx) \
149 + --without-x
150 +
151 + # remove useless subdirs
152 + if ! multilib_is_native_abi ; then
153 + sed -i \
154 + -e 's/ tools//' \
155 + -e 's/ contrib//' \
156 + -e 's/ man//' \
157 + -e 's/ html//' \
158 + Makefile || die
159 + fi
160 +}
161 +
162 +multilib_src_test() {
163 + if ! multilib_is_native_abi ; then
164 + emake -C tools
165 + fi
166 + emake check
167 +}
168 +
169 +multilib_src_install_all() {
170 + prune_libtool_files --all
171 + rm -f "${ED}"/usr/share/doc/${PF}/{COPYRIGHT,README*,RELEASE-DATE,TODO,VERSION}
172 +}