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
5 static const char module[] = "_TIFFVSetField";
7 + const TIFFFieldInfo* fip;
8 TIFFDirectory* td = &tif->tif_dir;
11 @@ -585,17 +586,19 @@ end:
15 + fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
16 TIFFErrorExt(tif->tif_clientdata, module,
17 "%s: Bad value %d for \"%s\" tag",
19 - _TIFFFieldWithTag(tif, tag)->field_name);
20 + fip ? fip->field_name : "Unknown");
24 + fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
25 TIFFErrorExt(tif->tif_clientdata, module,
26 "%s: Bad value %u for \"%s\" tag",
28 - _TIFFFieldWithTag(tif, tag)->field_name);
29 + fip ? fip->field_name : "Unknown");
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)
36 TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag",
37 "Internal error, unknown tag 0x%x",
39 - assert(fip != NULL);
44 @@ -821,8 +819,6 @@ _TIFFFieldWithName(TIFF* tif, const char
46 TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName",
47 "Internal error, unknown tag %s", field_name);
48 - assert(fip != NULL);
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)
59 + if (!compressionknown) {
60 + TIFFWarningExt(tif->tif_clientdata, module,
61 + "Ignoring, compression unknown");
64 if (!_TIFFMergeFieldInfo(tif,
65 _TIFFCreateAnonFieldInfo(tif,
67 @@ -583,6 +588,7 @@ TIFFReadDirectory(TIFF* tif)
68 * Attempt to deal with a missing StripByteCounts tag.
70 if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
71 + const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
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",
79 - _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
80 + fip ? fip->field_name : "Unknown");
81 if (EstimateStripByteCounts(tif, dir, dircount) < 0)
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);
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,
94 "%s: Bogus \"%s\" field, ignoring and calculating from imagelength",
96 - _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
97 + fip ? fip->field_name : "Unknown");
98 if(EstimateStripByteCounts(tif, dir, dircount) < 0)
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);
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,
111 "%s: Wrong \"%s\" field, ignoring and calculating from imagelength",
113 - _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
114 + fip ? fip->field_name : "Unknown");
115 if (EstimateStripByteCounts(tif, dir, dircount) < 0)
118 @@ -1024,16 +1032,18 @@ TIFFCheckDirOffset(TIFF* tif, toff_t dir
120 CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
122 + const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
124 if (count > dir->tdir_count) {
125 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
126 "incorrect count for field \"%s\" (%u, expecting %u); tag ignored",
127 - _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
128 + fip ? fip->field_name : "Unknown",
129 dir->tdir_count, count);
131 } else if (count < dir->tdir_count) {
132 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
133 "incorrect count for field \"%s\" (%u, expecting %u); tag trimmed",
134 - _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
135 + fip ? fip->field_name : "Unknown",
136 dir->tdir_count, count);
139 @@ -1153,6 +1163,7 @@ static tsize_t
140 TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
142 uint32 w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
143 + const TIFFFieldInfo* fip;
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
151 + fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
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");
159 @@ -1229,9 +1241,10 @@ static int
160 cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
163 + const TIFFFieldInfo *fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
164 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
165 "%s: Rational with zero denominator (num = %u)",
166 - _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
167 + fip ? fip->field_name : "Unknown", num);
170 if (dir->tdir_type == TIFF_RATIONAL)
171 @@ -1351,9 +1364,10 @@ TIFFFetchShortPair(TIFF* tif, TIFFDirEnt
172 * check on tdir_count, this should never be greater than two.
174 if (dir->tdir_count > 2) {
175 + const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
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",
183 @@ -1529,11 +1543,14 @@ TIFFFetchAnyArray(TIFF* tif, TIFFDirEntr
188 + const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
189 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
190 "cannot read TIFF_ANY type %d for field \"%s\"",
192 - _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
193 + fip ? fip->field_name : "Unknown");
199 @@ -1548,6 +1565,8 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt
201 const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag);
205 if (dp->tdir_count > 1) { /* array of values */
208 @@ -1707,9 +1726,10 @@ TIFFFetchPerSampleShorts(TIFF* tif, TIFF
210 for (i = 1; i < check_count; i++)
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");
220 @@ -1748,9 +1768,10 @@ TIFFFetchPerSampleLongs(TIFF* tif, TIFFD
221 check_count = samples;
222 for (i = 1; i < check_count; i++)
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");
232 @@ -1788,9 +1809,10 @@ TIFFFetchPerSampleAnys(TIFF* tif, TIFFDi
234 for (i = 1; i < check_count; i++)
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");