- updated to 3.9.5
[packages/crossmingw32-libtiff.git] / libtiff-sec.patch
CommitLineData
ede1b237
JB
1--- tiff-3.9.1/libtiff/tif_dir.c.orig 2009-01-01 01:10:43.000000000 +0100
2+++ tiff-3.9.1/libtiff/tif_dir.c 2009-08-31 17:46:34.892612613 +0200
3@@ -138,6 +138,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va
6a63362f
AG
4 {
5 static const char module[] = "_TIFFVSetField";
ede1b237
JB
6
7+ const TIFFFieldInfo* fip;
6a63362f
AG
8 TIFFDirectory* td = &tif->tif_dir;
9 int status = 1;
10 uint32 v32, i, v;
ede1b237
JB
11@@ -585,17 +586,19 @@ end:
12 va_end(ap);
6a63362f
AG
13 return (status);
14 badvalue:
ede1b237
JB
15+ fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
16 TIFFErrorExt(tif->tif_clientdata, module,
17 "%s: Bad value %d for \"%s\" tag",
18 tif->tif_name, v,
19- _TIFFFieldWithTag(tif, tag)->field_name);
20+ fip ? fip->field_name : "Unknown");
6a63362f
AG
21 va_end(ap);
22 return (0);
23 badvalue32:
ede1b237
JB
24+ fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
25 TIFFErrorExt(tif->tif_clientdata, module,
26 "%s: Bad value %u for \"%s\" tag",
27 tif->tif_name, v32,
28- _TIFFFieldWithTag(tif, tag)->field_name);
29+ fip ? fip->field_name : "Unknown");
6a63362f
AG
30 va_end(ap);
31 return (0);
32 }
ede1b237
JB
33--- tiff-3.9.1/libtiff/tif_dirread.c.orig 2009-01-01 01:10:43.000000000 +0100
34+++ tiff-3.9.1/libtiff/tif_dirread.c 2009-08-31 18:38:28.060606747 +0200
35@@ -190,6 +190,11 @@ TIFFReadDirectory(TIFF* tif)
6a63362f 36 dp->tdir_tag,
ede1b237
JB
37 dp->tdir_tag);
38
39+ if (!compressionknown) {
40+ TIFFWarningExt(tif->tif_clientdata, module,
41+ "Ignoring, compression unknown");
42+ goto ignore;
43+ }
44 if (!_TIFFMergeFieldInfo(tif,
45 _TIFFCreateAnonFieldInfo(tif,
46 dp->tdir_tag,
47@@ -583,6 +588,7 @@ TIFFReadDirectory(TIFF* tif)
48 * Attempt to deal with a missing StripByteCounts tag.
6a63362f 49 */
ede1b237
JB
50 if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
51+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
52 /*
53 * Some manufacturers violate the spec by not giving
54 * the size of the strips. In this case, assume there
55@@ -599,7 +605,7 @@ TIFFReadDirectory(TIFF* tif)
56 "%s: TIFF directory is missing required "
57 "\"%s\" field, calculating from imagelength",
58 tif->tif_name,
59- _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
60+ fip ? fip->field_name : "Unknown");
61 if (EstimateStripByteCounts(tif, dir, dircount) < 0)
62 goto bad;
6a63362f 63 /*
ede1b237
JB
64@@ -626,6 +632,7 @@ TIFFReadDirectory(TIFF* tif)
65 } else if (td->td_nstrips == 1
66 && td->td_stripoffset[0] != 0
67 && BYTECOUNTLOOKSBAD) {
68+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
69 /*
70 * XXX: Plexus (and others) sometimes give a value of
71 * zero for a tag when they don't know what the
72@@ -635,7 +642,7 @@ TIFFReadDirectory(TIFF* tif)
73 TIFFWarningExt(tif->tif_clientdata, module,
6a63362f 74 "%s: Bogus \"%s\" field, ignoring and calculating from imagelength",
ede1b237
JB
75 tif->tif_name,
76- _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
77+ fip ? fip->field_name : "Unknown");
78 if(EstimateStripByteCounts(tif, dir, dircount) < 0)
79 goto bad;
80 } else if (td->td_planarconfig == PLANARCONFIG_CONTIG
81@@ -644,6 +651,7 @@ TIFFReadDirectory(TIFF* tif)
82 && td->td_stripbytecount[0] != td->td_stripbytecount[1]
83 && td->td_stripbytecount[0] != 0
84 && td->td_stripbytecount[1] != 0 ) {
85+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
86 /*
87 * XXX: Some vendors fill StripByteCount array with
88 * absolutely wrong values (it can be equal to
89@@ -653,7 +661,7 @@ TIFFReadDirectory(TIFF* tif)
90 TIFFWarningExt(tif->tif_clientdata, module,
6a63362f 91 "%s: Wrong \"%s\" field, ignoring and calculating from imagelength",
ede1b237
JB
92 tif->tif_name,
93- _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
94+ fip ? fip->field_name : "Unknown");
95 if (EstimateStripByteCounts(tif, dir, dircount) < 0)
96 goto bad;
97 }
98@@ -1024,16 +1032,18 @@ TIFFCheckDirOffset(TIFF* tif, toff_t dir
6a63362f
AG
99 static int
100 CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
101 {
102+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
103+
104 if (count > dir->tdir_count) {
105 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
ede1b237 106 "incorrect count for field \"%s\" (%u, expecting %u); tag ignored",
6a63362f
AG
107- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
108+ fip ? fip->field_name : "Unknown",
109 dir->tdir_count, count);
110 return (0);
111 } else if (count < dir->tdir_count) {
112 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
ede1b237 113 "incorrect count for field \"%s\" (%u, expecting %u); tag trimmed",
6a63362f
AG
114- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
115+ fip ? fip->field_name : "Unknown",
116 dir->tdir_count, count);
117 return (1);
118 }
ede1b237 119@@ -1153,6 +1163,7 @@ static tsize_t
6a63362f
AG
120 TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
121 {
ede1b237
JB
122 uint32 w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
123+ const TIFFFieldInfo* fip;
124 /*
125 * FIXME: butecount should have tsize_t type, but for now libtiff
126 * defines tsize_t as a signed 32-bit integer and we are losing
127@@ -1200,9 +1211,10 @@ TIFFFetchData(TIFF* tif, TIFFDirEntry* d
128 }
129 return (cc);
6a63362f 130 bad:
ede1b237 131+ fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
6a63362f
AG
132 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
133 "Error fetching data for field \"%s\"",
134- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
135+ fip ? fip->field_name : "Unknown");
136 return (tsize_t) 0;
137 }
138
ede1b237 139@@ -1229,9 +1241,10 @@ static int
6a63362f
AG
140 cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
141 {
6a63362f 142 if (denom == 0) {
ede1b237 143+ const TIFFFieldInfo *fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
6a63362f 144 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
ede1b237 145 "%s: Rational with zero denominator (num = %u)",
6a63362f
AG
146- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
147+ fip ? fip->field_name : "Unknown", num);
148 return (0);
149 } else {
150 if (dir->tdir_type == TIFF_RATIONAL)
ede1b237
JB
151@@ -1351,9 +1364,10 @@ TIFFFetchShortPair(TIFF* tif, TIFFDirEnt
152 * check on tdir_count, this should never be greater than two.
153 */
154 if (dir->tdir_count > 2) {
6a63362f 155+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
ede1b237
JB
156 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
157 "unexpected count for field \"%s\", %u, expected 2; ignored",
158- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
159+ fip ? fip->field_name : "Unknown",
160 dir->tdir_count);
161 return 0;
162 }
163@@ -1529,11 +1543,14 @@ TIFFFetchAnyArray(TIFF* tif, TIFFDirEntr
6a63362f
AG
164 /* TIFF_NOTYPE */
165 /* TIFF_ASCII */
166 /* TIFF_UNDEFINED */
ede1b237
JB
167+ {
168+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
6a63362f
AG
169 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
170 "cannot read TIFF_ANY type %d for field \"%s\"",
171 dir->tdir_type,
172- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
6a63362f 173+ fip ? fip->field_name : "Unknown");
ede1b237
JB
174 return (0);
175+ }
6a63362f
AG
176 }
177 return (1);
178 }
ede1b237 179@@ -1548,6 +1565,8 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt
6a63362f
AG
180 int ok = 0;
181 const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag);
182
ede1b237 183+ if (fip == NULL)
6a63362f 184+ return (0);
6a63362f
AG
185 if (dp->tdir_count > 1) { /* array of values */
186 char* cp = NULL;
187
ede1b237 188@@ -1707,9 +1726,10 @@ TIFFFetchPerSampleShorts(TIFF* tif, TIFF
6a63362f
AG
189
190 for (i = 1; i < check_count; i++)
191 if (v[i] != v[0]) {
ede1b237
JB
192+ const TIFFFieldInfo *fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
193 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
194 "Cannot handle different per-sample values for field \"%s\"",
195- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
196+ fip ? fip->field_name : "Unknown");
197 goto bad;
6a63362f
AG
198 }
199 *pl = v[0];
ede1b237 200@@ -1748,9 +1768,10 @@ TIFFFetchPerSampleLongs(TIFF* tif, TIFFD
6a63362f
AG
201 check_count = samples;
202 for (i = 1; i < check_count; i++)
203 if (v[i] != v[0]) {
ede1b237
JB
204+ const TIFFFieldInfo *fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
205 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
206 "Cannot handle different per-sample values for field \"%s\"",
207- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
208+ fip ? fip->field_name : "Unknown");
209 goto bad;
6a63362f
AG
210 }
211 *pl = v[0];
This page took 0.110196 seconds and 4 git commands to generate.