1
From 8b6e80fca434525497e5a31c3309a3bab5b3c1c8 Mon Sep 17 00:00:00 2001
2
From: erouault <erouault>
3
Date: Sun, 21 Dec 2014 18:52:42 +0000
4
Subject: [PATCH] * tools/thumbnail.c, tools/tiffcmp.c: only read/write
5
TIFFTAG_GROUP3OPTIONS or TIFFTAG_GROUP4OPTIONS if compression is
6
COMPRESSION_CCITTFAX3 or COMPRESSION_CCITTFAX4
7
http://bugzilla.maptools.org/show_bug.cgi?id=2493 (CVE-2014-8128)
11
tools/thumbnail.c | 21 ++++++++++++++++++++-
12
tools/tiffcmp.c | 17 +++++++++++++++--
13
3 files changed, 42 insertions(+), 3 deletions(-)
15
Index: tiff-3.9.5/tools/thumbnail.c
16
===================================================================
17
--- tiff-3.9.5.orig/tools/thumbnail.c 2015-03-30 07:47:00.561025658 -0400
18
+++ tiff-3.9.5/tools/thumbnail.c 2015-03-30 07:47:00.561025658 -0400
22
for (p = tags; p < &tags[NTAGS]; p++)
23
- cpTag(in, out, p->tag, p->count, p->type);
25
+ /* Horrible: but TIFFGetField() expects 2 arguments to be passed */
26
+ /* if we request a tag that is defined in a codec, but that codec */
28
+ if( p->tag == TIFFTAG_GROUP3OPTIONS )
31
+ if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
32
+ compression != COMPRESSION_CCITTFAX3 )
35
+ if( p->tag == TIFFTAG_GROUP4OPTIONS )
38
+ if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
39
+ compression != COMPRESSION_CCITTFAX4 )
42
+ cpTag(in, out, p->tag, p->count, p->type);
47
Index: tiff-3.9.5/tools/tiffcmp.c
48
===================================================================
49
--- tiff-3.9.5.orig/tools/tiffcmp.c 2015-03-30 07:47:00.561025658 -0400
50
+++ tiff-3.9.5/tools/tiffcmp.c 2015-03-30 07:47:00.561025658 -0400
53
cmptags(TIFF* tif1, TIFF* tif2)
55
+ uint16 compression1, compression2;
56
CmpLongField(TIFFTAG_SUBFILETYPE, "SubFileType");
57
CmpLongField(TIFFTAG_IMAGEWIDTH, "ImageWidth");
58
CmpLongField(TIFFTAG_IMAGELENGTH, "ImageLength");
60
CmpShortField(TIFFTAG_SAMPLEFORMAT, "SampleFormat");
61
CmpFloatField(TIFFTAG_XRESOLUTION, "XResolution");
62
CmpFloatField(TIFFTAG_YRESOLUTION, "YResolution");
63
- CmpLongField(TIFFTAG_GROUP3OPTIONS, "Group3Options");
64
- CmpLongField(TIFFTAG_GROUP4OPTIONS, "Group4Options");
65
+ if( TIFFGetField(tif1, TIFFTAG_COMPRESSION, &compression1) &&
66
+ compression1 == COMPRESSION_CCITTFAX3 &&
67
+ TIFFGetField(tif2, TIFFTAG_COMPRESSION, &compression2) &&
68
+ compression2 == COMPRESSION_CCITTFAX3 )
70
+ CmpLongField(TIFFTAG_GROUP3OPTIONS, "Group3Options");
72
+ if( TIFFGetField(tif1, TIFFTAG_COMPRESSION, &compression1) &&
73
+ compression1 == COMPRESSION_CCITTFAX4 &&
74
+ TIFFGetField(tif2, TIFFTAG_COMPRESSION, &compression2) &&
75
+ compression2 == COMPRESSION_CCITTFAX4 )
77
+ CmpLongField(TIFFTAG_GROUP4OPTIONS, "Group4Options");
79
CmpShortField(TIFFTAG_RESOLUTIONUNIT, "ResolutionUnit");
80
CmpShortField(TIFFTAG_PLANARCONFIG, "PlanarConfiguration");
81
CmpLongField(TIFFTAG_ROWSPERSTRIP, "RowsPerStrip");