]> git.pld-linux.org Git - packages/crossmingw32-libtiff.git/blob - libtiff-sec.patch
- fixed _dlldir
[packages/crossmingw32-libtiff.git] / libtiff-sec.patch
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
4  {
5         static const char module[] = "_TIFFVSetField";
6  
7 +       const TIFFFieldInfo* fip;
8         TIFFDirectory* td = &tif->tif_dir;
9         int status = 1;
10         uint32 v32, i, v;
11 @@ -585,17 +586,19 @@ end:
12         va_end(ap);
13         return (status);
14  badvalue:
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");
21         va_end(ap);
22         return (0);
23  badvalue32:
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");
30         va_end(ap);
31         return (0);
32  }
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)
36                                                        dp->tdir_tag,
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.
49                  */
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;
63                 /*
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,
74         "%s: Bogus \"%s\" field, ignoring and calculating from imagelength",
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,
91         "%s: Wrong \"%s\" field, ignoring and calculating from imagelength",
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
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,
106         "incorrect count for field \"%s\" (%u, expecting %u); tag ignored",
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,
113         "incorrect count for field \"%s\" (%u, expecting %u); tag trimmed",
114 -                   _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
115 +                   fip ? fip->field_name : "Unknown",
116                     dir->tdir_count, count);
117                 return (1);
118         }
119 @@ -1153,6 +1163,7 @@ static tsize_t
120  TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
121  {
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);
130  bad:
131 +       fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
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  
139 @@ -1229,9 +1241,10 @@ static int
140  cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
141  {
142         if (denom == 0) {
143 +               const TIFFFieldInfo *fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
144                 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
145                     "%s: Rational with zero denominator (num = %u)",
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)
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) {
155 +               const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
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
164                 /* TIFF_NOTYPE */
165                 /* TIFF_ASCII */
166                 /* TIFF_UNDEFINED */
167 +               {
168 +               const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
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);
173 +                            fip ? fip->field_name : "Unknown");
174                 return (0);
175 +               }
176         }
177         return (1);
178  }
179 @@ -1548,6 +1565,8 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt
180         int ok = 0;
181         const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag);
182  
183 +       if (fip == NULL)
184 +               return (0);
185         if (dp->tdir_count > 1) {               /* array of values */
186                 char* cp = NULL;
187  
188 @@ -1707,9 +1726,10 @@ TIFFFetchPerSampleShorts(TIFF* tif, TIFF
189  
190              for (i = 1; i < check_count; i++)
191                  if (v[i] != v[0]) {
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;
198                  }
199              *pl = v[0];
200 @@ -1748,9 +1768,10 @@ TIFFFetchPerSampleLongs(TIFF* tif, TIFFD
201                  check_count = samples;
202              for (i = 1; i < check_count; i++)
203                  if (v[i] != v[0]) {
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;
210                  }
211              *pl = v[0];
This page took 0.083093 seconds and 3 git commands to generate.