Gentoo Archives: gentoo-commits

From: Aaron Bauman <bman@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/tiff/files/
Date: Sat, 20 Apr 2019 23:20:03
Message-Id: 1555723633.6d9c2b4589629519d5d6e01349ed4770356dfa4c.bman@gentoo
1 commit: 6d9c2b4589629519d5d6e01349ed4770356dfa4c
2 Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Fri Apr 19 18:03:11 2019 +0000
4 Commit: Aaron Bauman <bman <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 20 01:27:13 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d9c2b45
7
8 media-libs/tiff: remove unused patches
9
10 Signed-off-by: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail.com>
11 Closes: https://github.com/gentoo/gentoo/pull/11744
12 Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
13
14 .../tiff/files/tiff-4.0.9-CVE-2017-18013.patch | 39 ------
15 ...ff-4.0.9-CVE-2017-9935-fix-incorrect-type.patch | 58 --------
16 .../tiff/files/tiff-4.0.9-CVE-2017-9935.patch | 153 ---------------------
17 .../tiff/files/tiff-4.0.9-CVE-2018-5784.patch | 128 -----------------
18 4 files changed, 378 deletions(-)
19
20 diff --git a/media-libs/tiff/files/tiff-4.0.9-CVE-2017-18013.patch b/media-libs/tiff/files/tiff-4.0.9-CVE-2017-18013.patch
21 deleted file mode 100644
22 index 2db890aef90..00000000000
23 --- a/media-libs/tiff/files/tiff-4.0.9-CVE-2017-18013.patch
24 +++ /dev/null
25 @@ -1,39 +0,0 @@
26 -https://bugs.gentoo.org/645982
27 -https://gitlab.com/libtiff/libtiff/commit/c6f41df7b581402dfba3c19a1e3df4454c551a01
28 -
29 -From c6f41df7b581402dfba3c19a1e3df4454c551a01 Mon Sep 17 00:00:00 2001
30 -From: Even Rouault <even.rouault@×××××××××.com>
31 -Date: Sun, 31 Dec 2017 15:09:41 +0100
32 -Subject: [PATCH] libtiff/tif_print.c: TIFFPrintDirectory(): fix null pointer
33 - dereference on corrupted file. Fixes
34 - http://bugzilla.maptools.org/show_bug.cgi?id=2770
35 -
36 ----
37 - libtiff/tif_print.c | 8 ++++----
38 - 1 file changed, 4 insertions(+), 4 deletions(-)
39 -
40 -diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
41 -index 9959d353b1f9..8deceb2b054d 100644
42 ---- a/libtiff/tif_print.c
43 -+++ b/libtiff/tif_print.c
44 -@@ -665,13 +665,13 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
45 - #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
46 - fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
47 - (unsigned long) s,
48 -- (unsigned __int64) td->td_stripoffset[s],
49 -- (unsigned __int64) td->td_stripbytecount[s]);
50 -+ td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0,
51 -+ td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0);
52 - #else
53 - fprintf(fd, " %3lu: [%8llu, %8llu]\n",
54 - (unsigned long) s,
55 -- (unsigned long long) td->td_stripoffset[s],
56 -- (unsigned long long) td->td_stripbytecount[s]);
57 -+ td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0,
58 -+ td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0);
59 - #endif
60 - }
61 - }
62 ---
63 -2.16.1
64 -
65
66 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
67 deleted file mode 100644
68 index 101618ee7d5..00000000000
69 --- a/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935-fix-incorrect-type.patch
70 +++ /dev/null
71 @@ -1,58 +0,0 @@
72 -From d4f213636b6f950498a1386083199bd7f65676b9 Mon Sep 17 00:00:00 2001
73 -From: Brian May <brian@×××××××××××××.xyz>
74 -Date: Thu, 7 Dec 2017 07:49:20 +1100
75 -Subject: [PATCH] tiff2pdf: Fix apparent incorrect type for transfer table
76 -
77 -The standard says the transfer table contains unsigned 16 bit values,
78 -I have no idea why we refer to them as floats.
79 ----
80 - tools/tiff2pdf.c | 12 ++++++------
81 - 1 file changed, 6 insertions(+), 6 deletions(-)
82 -
83 -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
84 -index c3ec074..484776c 100644
85 ---- a/tools/tiff2pdf.c
86 -+++ b/tools/tiff2pdf.c
87 -@@ -237,7 +237,7 @@ typedef struct {
88 - float tiff_whitechromaticities[2];
89 - float tiff_primarychromaticities[6];
90 - float tiff_referenceblackwhite[2];
91 -- float* tiff_transferfunction[3];
92 -+ uint16* tiff_transferfunction[3];
93 - int pdf_image_interpolate; /* 0 (default) : do not interpolate,
94 - 1 : interpolate */
95 - uint16 tiff_transferfunctioncount;
96 -@@ -1048,7 +1048,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
97 - uint16 paged=0;
98 - uint16 xuint16=0;
99 - uint16 tiff_transferfunctioncount=0;
100 -- float* tiff_transferfunction[3];
101 -+ uint16* tiff_transferfunction[3];
102 -
103 - directorycount=TIFFNumberOfDirectories(input);
104 - t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_PAGE)));
105 -@@ -1153,8 +1153,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
106 - &(tiff_transferfunction[1]),
107 - &(tiff_transferfunction[2]))) {
108 -
109 -- if((tiff_transferfunction[1] != (float*) NULL) &&
110 -- (tiff_transferfunction[2] != (float*) NULL)
111 -+ if((tiff_transferfunction[1] != (uint16*) NULL) &&
112 -+ (tiff_transferfunction[2] != (uint16*) NULL)
113 - ) {
114 - tiff_transferfunctioncount=3;
115 - } else {
116 -@@ -1851,8 +1851,8 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
117 - &(t2p->tiff_transferfunction[0]),
118 - &(t2p->tiff_transferfunction[1]),
119 - &(t2p->tiff_transferfunction[2]))) {
120 -- if((t2p->tiff_transferfunction[1] != (float*) NULL) &&
121 -- (t2p->tiff_transferfunction[2] != (float*) NULL)
122 -+ if((t2p->tiff_transferfunction[1] != (uint16*) NULL) &&
123 -+ (t2p->tiff_transferfunction[2] != (uint16*) NULL)
124 - ) {
125 - t2p->tiff_transferfunctioncount=3;
126 - } else {
127 ---
128 -libgit2 0.26.0
129 -
130
131 diff --git a/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935.patch b/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935.patch
132 deleted file mode 100644
133 index 96a10aa9b37..00000000000
134 --- a/media-libs/tiff/files/tiff-4.0.9-CVE-2017-9935.patch
135 +++ /dev/null
136 @@ -1,153 +0,0 @@
137 -From 3dd8f6a357981a4090f126ab9025056c938b6940 Mon Sep 17 00:00:00 2001
138 -From: Brian May <brian@×××××××××××××.xyz>
139 -Date: Thu, 7 Dec 2017 07:46:47 +1100
140 -Subject: [PATCH] tiff2pdf: Fix CVE-2017-9935
141 -
142 -Fix for http://bugzilla.maptools.org/show_bug.cgi?id=2704
143 -
144 -This vulnerability - at least for the supplied test case - is because we
145 -assume that a tiff will only have one transfer function that is the same
146 -for all pages. This is not required by the TIFF standards.
147 -
148 -We than read the transfer function for every page. Depending on the
149 -transfer function, we allocate either 2 or 4 bytes to the XREF buffer.
150 -We allocate this memory after we read in the transfer function for the
151 -page.
152 -
153 -For the first exploit - POC1, this file has 3 pages. For the first page
154 -we allocate 2 extra extra XREF entries. Then for the next page 2 more
155 -entries. Then for the last page the transfer function changes and we
156 -allocate 4 more entries.
157 -
158 -When we read the file into memory, we assume we have 4 bytes extra for
159 -each and every page (as per the last transfer function we read). Which
160 -is not correct, we only have 2 bytes extra for the first 2 pages. As a
161 -result, we end up writing past the end of the buffer.
162 -
163 -There are also some related issues that this also fixes. For example,
164 -TIFFGetField can return uninitalized pointer values, and the logic to
165 -detect a N=3 vs N=1 transfer function seemed rather strange.
166 -
167 -It is also strange that we declare the transfer functions to be of type
168 -float, when the standard says they are unsigned 16 bit values. This is
169 -fixed in another patch.
170 -
171 -This patch will check to ensure that the N value for every transfer
172 -function is the same for every page. If this changes, we abort with an
173 -error. In theory, we should perhaps check that the transfer function
174 -itself is identical for every page, however we don't do that due to the
175 -confusion of the type of the data in the transfer function.
176 ----
177 - libtiff/tif_dir.c | 3 +++
178 - tools/tiff2pdf.c | 65 +++++++++++++++++++++++++++++++++++++------------------
179 - 2 files changed, 47 insertions(+), 21 deletions(-)
180 -
181 -diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
182 -index 2ccaf448fc40..cbf2b6933a40 100644
183 ---- a/libtiff/tif_dir.c
184 -+++ b/libtiff/tif_dir.c
185 -@@ -1065,6 +1065,9 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
186 - if (td->td_samplesperpixel - td->td_extrasamples > 1) {
187 - *va_arg(ap, uint16**) = td->td_transferfunction[1];
188 - *va_arg(ap, uint16**) = td->td_transferfunction[2];
189 -+ } else {
190 -+ *va_arg(ap, uint16**) = NULL;
191 -+ *va_arg(ap, uint16**) = NULL;
192 - }
193 - break;
194 - case TIFFTAG_REFERENCEBLACKWHITE:
195 -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
196 -index d1a9b0959f84..c3ec07465e5a 100644
197 ---- a/tools/tiff2pdf.c
198 -+++ b/tools/tiff2pdf.c
199 -@@ -1047,6 +1047,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
200 - uint16 pagen=0;
201 - uint16 paged=0;
202 - uint16 xuint16=0;
203 -+ uint16 tiff_transferfunctioncount=0;
204 -+ float* tiff_transferfunction[3];
205 -
206 - directorycount=TIFFNumberOfDirectories(input);
207 - t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_PAGE)));
208 -@@ -1147,26 +1149,48 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
209 - }
210 - #endif
211 - if (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,
212 -- &(t2p->tiff_transferfunction[0]),
213 -- &(t2p->tiff_transferfunction[1]),
214 -- &(t2p->tiff_transferfunction[2]))) {
215 -- if((t2p->tiff_transferfunction[1] != (float*) NULL) &&
216 -- (t2p->tiff_transferfunction[2] != (float*) NULL) &&
217 -- (t2p->tiff_transferfunction[1] !=
218 -- t2p->tiff_transferfunction[0])) {
219 -- t2p->tiff_transferfunctioncount = 3;
220 -- t2p->tiff_pages[i].page_extra += 4;
221 -- t2p->pdf_xrefcount += 4;
222 -- } else {
223 -- t2p->tiff_transferfunctioncount = 1;
224 -- t2p->tiff_pages[i].page_extra += 2;
225 -- t2p->pdf_xrefcount += 2;
226 -- }
227 -- if(t2p->pdf_minorversion < 2)
228 -- t2p->pdf_minorversion = 2;
229 -+ &(tiff_transferfunction[0]),
230 -+ &(tiff_transferfunction[1]),
231 -+ &(tiff_transferfunction[2]))) {
232 -+
233 -+ if((tiff_transferfunction[1] != (float*) NULL) &&
234 -+ (tiff_transferfunction[2] != (float*) NULL)
235 -+ ) {
236 -+ tiff_transferfunctioncount=3;
237 -+ } else {
238 -+ tiff_transferfunctioncount=1;
239 -+ }
240 - } else {
241 -- t2p->tiff_transferfunctioncount=0;
242 -+ tiff_transferfunctioncount=0;
243 - }
244 -+
245 -+ if (i > 0){
246 -+ if (tiff_transferfunctioncount != t2p->tiff_transferfunctioncount){
247 -+ TIFFError(
248 -+ TIFF2PDF_MODULE,
249 -+ "Different transfer function on page %d",
250 -+ i);
251 -+ t2p->t2p_error = T2P_ERR_ERROR;
252 -+ return;
253 -+ }
254 -+ }
255 -+
256 -+ t2p->tiff_transferfunctioncount = tiff_transferfunctioncount;
257 -+ t2p->tiff_transferfunction[0] = tiff_transferfunction[0];
258 -+ t2p->tiff_transferfunction[1] = tiff_transferfunction[1];
259 -+ t2p->tiff_transferfunction[2] = tiff_transferfunction[2];
260 -+ if(tiff_transferfunctioncount == 3){
261 -+ t2p->tiff_pages[i].page_extra += 4;
262 -+ t2p->pdf_xrefcount += 4;
263 -+ if(t2p->pdf_minorversion < 2)
264 -+ t2p->pdf_minorversion = 2;
265 -+ } else if (tiff_transferfunctioncount == 1){
266 -+ t2p->tiff_pages[i].page_extra += 2;
267 -+ t2p->pdf_xrefcount += 2;
268 -+ if(t2p->pdf_minorversion < 2)
269 -+ t2p->pdf_minorversion = 2;
270 -+ }
271 -+
272 - if( TIFFGetField(
273 - input,
274 - TIFFTAG_ICCPROFILE,
275 -@@ -1828,9 +1852,8 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
276 - &(t2p->tiff_transferfunction[1]),
277 - &(t2p->tiff_transferfunction[2]))) {
278 - if((t2p->tiff_transferfunction[1] != (float*) NULL) &&
279 -- (t2p->tiff_transferfunction[2] != (float*) NULL) &&
280 -- (t2p->tiff_transferfunction[1] !=
281 -- t2p->tiff_transferfunction[0])) {
282 -+ (t2p->tiff_transferfunction[2] != (float*) NULL)
283 -+ ) {
284 - t2p->tiff_transferfunctioncount=3;
285 - } else {
286 - t2p->tiff_transferfunctioncount=1;
287 ---
288 -2.15.1
289 -
290
291 diff --git a/media-libs/tiff/files/tiff-4.0.9-CVE-2018-5784.patch b/media-libs/tiff/files/tiff-4.0.9-CVE-2018-5784.patch
292 deleted file mode 100644
293 index 56d0f4b0687..00000000000
294 --- a/media-libs/tiff/files/tiff-4.0.9-CVE-2018-5784.patch
295 +++ /dev/null
296 @@ -1,128 +0,0 @@
297 -From 473851d211cf8805a161820337ca74cc9615d6ef Mon Sep 17 00:00:00 2001
298 -From: Nathan Baker <nathanb@×××××××××××××.com>
299 -Date: Tue, 6 Feb 2018 10:13:57 -0500
300 -Subject: [PATCH] Fix for bug 2772
301 -
302 -It is possible to craft a TIFF document where the IFD list is circular,
303 -leading to an infinite loop while traversing the chain. The libtiff
304 -directory reader has a failsafe that will break out of this loop after
305 -reading 65535 directory entries, but it will continue processing,
306 -consuming time and resources to process what is essentially a bogus TIFF
307 -document.
308 -
309 -This change fixes the above behavior by breaking out of processing when
310 -a TIFF document has >= 65535 directories and terminating with an error.
311 ----
312 - contrib/addtiffo/tif_overview.c | 14 +++++++++++++-
313 - tools/tiff2pdf.c | 10 ++++++++++
314 - tools/tiffcrop.c | 13 +++++++++++--
315 - 3 files changed, 34 insertions(+), 3 deletions(-)
316 -
317 -diff --git a/contrib/addtiffo/tif_overview.c b/contrib/addtiffo/tif_overview.c
318 -index c61ffbb..03b3573 100644
319 ---- a/contrib/addtiffo/tif_overview.c
320 -+++ b/contrib/addtiffo/tif_overview.c
321 -@@ -65,6 +65,8 @@
322 - # define MAX(a,b) ((a>b) ? a : b)
323 - #endif
324 -
325 -+#define TIFF_DIR_MAX 65534
326 -+
327 - void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
328 - int (*)(double,void*), void * );
329 -
330 -@@ -91,6 +93,7 @@ uint32 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 nYSize,
331 - {
332 - toff_t nBaseDirOffset;
333 - toff_t nOffset;
334 -+ tdir_t iNumDir;
335 -
336 - (void) bUseSubIFDs;
337 -
338 -@@ -147,7 +150,16 @@ uint32 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 nYSize,
339 - return 0;
340 -
341 - TIFFWriteDirectory( hTIFF );
342 -- TIFFSetDirectory( hTIFF, (tdir_t) (TIFFNumberOfDirectories(hTIFF)-1) );
343 -+ iNumDir = TIFFNumberOfDirectories(hTIFF);
344 -+ if( iNumDir > TIFF_DIR_MAX )
345 -+ {
346 -+ TIFFErrorExt( TIFFClientdata(hTIFF),
347 -+ "TIFF_WriteOverview",
348 -+ "File `%s' has too many directories.\n",
349 -+ TIFFFileName(hTIFF) );
350 -+ exit(-1);
351 -+ }
352 -+ TIFFSetDirectory( hTIFF, (tdir_t) (iNumDir - 1) );
353 -
354 - nOffset = TIFFCurrentDirOffset( hTIFF );
355 -
356 -diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
357 -index 984ef65..832a247 100644
358 ---- a/tools/tiff2pdf.c
359 -+++ b/tools/tiff2pdf.c
360 -@@ -68,6 +68,8 @@ extern int getopt(int, char**, char*);
361 -
362 - #define PS_UNIT_SIZE 72.0F
363 -
364 -+#define TIFF_DIR_MAX 65534
365 -+
366 - /* This type is of PDF color spaces. */
367 - typedef enum {
368 - T2P_CS_BILEVEL = 0x01, /* Bilevel, black and white */
369 -@@ -1051,6 +1053,14 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
370 - uint16* tiff_transferfunction[3];
371 -
372 - directorycount=TIFFNumberOfDirectories(input);
373 -+ if(directorycount > TIFF_DIR_MAX) {
374 -+ TIFFError(
375 -+ TIFF2PDF_MODULE,
376 -+ "TIFF contains too many directories, %s",
377 -+ TIFFFileName(input));
378 -+ t2p->t2p_error = T2P_ERR_ERROR;
379 -+ return;
380 -+ }
381 - t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_PAGE)));
382 - if(t2p->tiff_pages==NULL){
383 - TIFFError(
384 -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
385 -index 91a38f6..e466dae 100644
386 ---- a/tools/tiffcrop.c
387 -+++ b/tools/tiffcrop.c
388 -@@ -215,6 +215,8 @@ extern int getopt(int argc, char * const argv[], const char *optstring);
389 - #define DUMP_TEXT 1
390 - #define DUMP_RAW 2
391 -
392 -+#define TIFF_DIR_MAX 65534
393 -+
394 - /* Offsets into buffer for margins and fixed width and length segments */
395 - struct offset {
396 - uint32 tmargin;
397 -@@ -2232,7 +2234,7 @@ main(int argc, char* argv[])
398 - pageNum = -1;
399 - else
400 - total_images = 0;
401 -- /* read multiple input files and write to output file(s) */
402 -+ /* Read multiple input files and write to output file(s) */
403 - while (optind < argc - 1)
404 - {
405 - in = TIFFOpen (argv[optind], "r");
406 -@@ -2240,7 +2242,14 @@ main(int argc, char* argv[])
407 - return (-3);
408 -
409 - /* If only one input file is specified, we can use directory count */
410 -- total_images = TIFFNumberOfDirectories(in);
411 -+ total_images = TIFFNumberOfDirectories(in);
412 -+ if (total_images > TIFF_DIR_MAX)
413 -+ {
414 -+ TIFFError (TIFFFileName(in), "File contains too many directories");
415 -+ if (out != NULL)
416 -+ (void) TIFFClose(out);
417 -+ return (1);
418 -+ }
419 - if (image_count == 0)
420 - {
421 - dirnum = 0;
422 ---
423 -libgit2 0.26.0
424 -