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