summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2013-1961.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/libtiff/files/libtiff-CVE-2013-1961.patch')
-rw-r--r--meta/recipes-multimedia/libtiff/files/libtiff-CVE-2013-1961.patch786
1 files changed, 0 insertions, 786 deletions
diff --git a/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2013-1961.patch b/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2013-1961.patch
deleted file mode 100644
index fc4adb59d8..0000000000
--- a/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2013-1961.patch
+++ /dev/null
@@ -1,786 +0,0 @@
1libtiff: fix CVE-2013-1961.
2
3Upstream-Status: Backported
4
5Issue Description: CVE-2013-1961
6Stack-based buffer overflow in the t2p_write_pdf_page function in tiff2pdf
7in libtiff before 4.0.3 allows remote attackers to cause a denial of service
8(application crash) via a crafted image length and resolution in a TIFF image file.
9
10Fix Description: Replace sprintf with snprintf
11
12Signed-off-by: Priyanka Shobhan <priyanka_shobhan@mentor.com>
13---
14
15diff --git a/contrib/dbs/xtiff/xtiff.c b/contrib/dbs/xtiff/xtiff.c
16index 2634030..97e4ffe 100644
17--- a/contrib/dbs/xtiff/xtiff.c
18+++ b/contrib/dbs/xtiff/xtiff.c
19@@ -512,9 +512,9 @@ SetNameLabel()
20 Arg args[1];
21
22 if (tfMultiPage)
23- sprintf(buffer, "%s - page %d", fileName, tfDirectory);
24+ snprintf(buffer, sizeof(buffer), "%s - page %d", fileName, tfDirectory);
25 else
26- strcpy(buffer, fileName);
27+ snprintf(buffer, sizeof(buffer), "%s", fileName);
28 XtSetArg(args[0], XtNlabel, buffer);
29 XtSetValues(labelWidget, args, 1);
30 }
31diff --git a/libtiff/tif_codec.c b/libtiff/tif_codec.c
32index e201667..703e87d 100644
33--- a/libtiff/tif_codec.c
34+++ b/libtiff/tif_codec.c
35@@ -108,7 +108,8 @@ _notConfigured(TIFF* tif)
36 const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
37 char compression_code[20];
38
39- sprintf( compression_code, "%d", tif->tif_dir.td_compression );
40+ snprintf(compression_code, sizeof(compression_code), "%d",
41+ tif->tif_dir.td_compression );
42 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
43 "%s compression support is not configured",
44 c ? c->name : compression_code );
45diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
46index d319931..4dae5e5 100644
47--- a/libtiff/tif_dirinfo.c
48+++ b/libtiff/tif_dirinfo.c
49@@ -711,7 +711,7 @@ _TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type)
50 * note that this name is a special sign to TIFFClose() and
51 * _TIFFSetupFields() to free the field
52 */
53- sprintf(fld->field_name, "Tag %d", (int) tag);
54+ snprintf(fld->field_name, 32, "Tag %d", (int) tag);
55
56 return fld;
57 }
58diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
59index 162aac1..a3eeb03 100644
60--- a/tools/rgb2ycbcr.c
61+++ b/tools/rgb2ycbcr.c
62@@ -332,7 +332,8 @@ tiffcvt(TIFF* in, TIFF* out)
63 TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
64 { char buf[2048];
65 char *cp = strrchr(TIFFFileName(in), '/');
66- sprintf(buf, "YCbCr conversion of %s", cp ? cp+1 : TIFFFileName(in));
67+ snprintf(buf, sizeof(buf), "YCbCr conversion of %s",
68+ cp ? cp+1 : TIFFFileName(in));
69 TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, buf);
70 }
71 TIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());
72diff --git a/tools/tiff2bw.c b/tools/tiff2bw.c
73index bda754a..7ffaca0 100644
74--- a/tools/tiff2bw.c
75+++ b/tools/tiff2bw.c
76@@ -205,7 +205,7 @@ main(int argc, char* argv[])
77 }
78 }
79 TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
80- sprintf(thing, "B&W version of %s", argv[optind]);
81+ snprintf(thing, sizeof(thing), "B&W version of %s", argv[optind]);
82 TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
83 TIFFSetField(out, TIFFTAG_SOFTWARE, "tiff2bw");
84 outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
85diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
86index 356328c..957fd9f 100644
87--- a/tools/tiff2pdf.c
88+++ b/tools/tiff2pdf.c
89@@ -3609,7 +3609,9 @@ tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){
90 char buffer[16];
91 int buflen=0;
92
93- buflen=sprintf(buffer, "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff);
94+ buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ",
95+ t2p->pdf_majorversion&0xff,
96+ t2p->pdf_minorversion&0xff);
97 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
98 written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7);
99
100@@ -3623,10 +3625,10 @@ tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){
101 tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
102
103 tsize_t written=0;
104- char buffer[16];
105+ char buffer[32];
106 int buflen=0;
107
108- buflen=sprintf(buffer, "%lu", (unsigned long)number);
109+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
110 written += t2pWriteFile(output, (tdata_t) buffer, buflen );
111 written += t2pWriteFile(output, (tdata_t) " 0 obj\n", 7);
112
113@@ -3665,13 +3667,13 @@ tsize_t t2p_write_pdf_name(unsigned char* name, TIFF* output){
114 written += t2pWriteFile(output, (tdata_t) "/", 1);
115 for (i=0;i<namelen;i++){
116 if ( ((unsigned char)name[i]) < 0x21){
117- sprintf(buffer, "#%.2X", name[i]);
118+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
119 buffer[sizeof(buffer) - 1] = '\0';
120 written += t2pWriteFile(output, (tdata_t) buffer, 3);
121 nextchar=1;
122 }
123 if ( ((unsigned char)name[i]) > 0x7E){
124- sprintf(buffer, "#%.2X", name[i]);
125+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
126 buffer[sizeof(buffer) - 1] = '\0';
127 written += t2pWriteFile(output, (tdata_t) buffer, 3);
128 nextchar=1;
129@@ -3679,57 +3681,57 @@ tsize_t t2p_write_pdf_name(unsigned char* name, TIFF* output){
130 if (nextchar==0){
131 switch (name[i]){
132 case 0x23:
133- sprintf(buffer, "#%.2X", name[i]);
134+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
135 buffer[sizeof(buffer) - 1] = '\0';
136 written += t2pWriteFile(output, (tdata_t) buffer, 3);
137 break;
138 case 0x25:
139- sprintf(buffer, "#%.2X", name[i]);
140+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
141 buffer[sizeof(buffer) - 1] = '\0';
142 written += t2pWriteFile(output, (tdata_t) buffer, 3);
143 break;
144 case 0x28:
145- sprintf(buffer, "#%.2X", name[i]);
146+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
147 buffer[sizeof(buffer) - 1] = '\0';
148 written += t2pWriteFile(output, (tdata_t) buffer, 3);
149 break;
150 case 0x29:
151- sprintf(buffer, "#%.2X", name[i]);
152+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
153 buffer[sizeof(buffer) - 1] = '\0';
154 written += t2pWriteFile(output, (tdata_t) buffer, 3);
155 break;
156 case 0x2F:
157- sprintf(buffer, "#%.2X", name[i]);
158+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
159 buffer[sizeof(buffer) - 1] = '\0';
160 written += t2pWriteFile(output, (tdata_t) buffer, 3);
161 break;
162 case 0x3C:
163- sprintf(buffer, "#%.2X", name[i]);
164+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
165 buffer[sizeof(buffer) - 1] = '\0';
166 written += t2pWriteFile(output, (tdata_t) buffer, 3);
167 break;
168 case 0x3E:
169- sprintf(buffer, "#%.2X", name[i]);
170+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
171 buffer[sizeof(buffer) - 1] = '\0';
172 written += t2pWriteFile(output, (tdata_t) buffer, 3);
173 break;
174 case 0x5B:
175- sprintf(buffer, "#%.2X", name[i]);
176+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
177 buffer[sizeof(buffer) - 1] = '\0';
178 written += t2pWriteFile(output, (tdata_t) buffer, 3);
179 break;
180 case 0x5D:
181- sprintf(buffer, "#%.2X", name[i]);
182+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
183 buffer[sizeof(buffer) - 1] = '\0';
184 written += t2pWriteFile(output, (tdata_t) buffer, 3);
185 break;
186 case 0x7B:
187- sprintf(buffer, "#%.2X", name[i]);
188+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
189 buffer[sizeof(buffer) - 1] = '\0';
190 written += t2pWriteFile(output, (tdata_t) buffer, 3);
191 break;
192 case 0x7D:
193- sprintf(buffer, "#%.2X", name[i]);
194+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
195 buffer[sizeof(buffer) - 1] = '\0';
196 written += t2pWriteFile(output, (tdata_t) buffer, 3);
197 break;
198@@ -3844,14 +3846,14 @@ tsize_t t2p_write_pdf_stream_end(TIFF* output){
199 tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
200
201 tsize_t written=0;
202- char buffer[16];
203+ char buffer[32];
204 int buflen=0;
205
206 written += t2pWriteFile(output, (tdata_t) "/Length ", 8);
207 if(len!=0){
208 written += t2p_write_pdf_stream_length(len, output);
209 } else {
210- buflen=sprintf(buffer, "%lu", (unsigned long)number);
211+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
212 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
213 written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
214 }
215@@ -3892,10 +3894,10 @@ tsize_t t2p_write_pdf_stream_dict_end(TIFF* output){
216 tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
217
218 tsize_t written=0;
219- char buffer[16];
220+ char buffer[32];
221 int buflen=0;
222
223- buflen=sprintf(buffer, "%lu", (unsigned long)len);
224+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)len);
225 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
226 written += t2pWriteFile(output, (tdata_t) "\n", 1);
227
228@@ -3909,7 +3911,7 @@ tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
229 tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output)
230 {
231 tsize_t written = 0;
232- char buffer[16];
233+ char buffer[32];
234 int buflen = 0;
235
236 written += t2pWriteFile(output,
237@@ -3948,7 +3950,6 @@ tsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output)
238 written += t2p_write_pdf_string(t2p->pdf_datetime, output);
239 }
240 written += t2pWriteFile(output, (tdata_t) "\n/Producer ", 11);
241- _TIFFmemset((tdata_t)buffer, 0x00, sizeof(buffer));
242 snprintf(buffer, sizeof(buffer), "libtiff / tiff2pdf - %d", TIFFLIB_VERSION);
243 written += t2p_write_pdf_string(buffer, output);
244 written += t2pWriteFile(output, (tdata_t) "\n", 1);
245@@ -4089,7 +4090,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
246 {
247 tsize_t written=0;
248 tdir_t i=0;
249- char buffer[16];
250+ char buffer[32];
251 int buflen=0;
252
253 int page=0;
254@@ -4097,7 +4098,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
255 (tdata_t) "<< \n/Type /Pages \n/Kids [ ", 26);
256 page = t2p->pdf_pages+1;
257 for (i=0;i<t2p->tiff_pagecount;i++){
258- buflen=sprintf(buffer, "%d", page);
259+ buflen=snprintf(buffer, sizeof(buffer), "%d", page);
260 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
261 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
262 if ( ((i+1)%8)==0 ) {
263@@ -4112,8 +4113,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
264 }
265 }
266 written += t2pWriteFile(output, (tdata_t) "] \n/Count ", 10);
267- _TIFFmemset(buffer, 0x00, 16);
268- buflen=sprintf(buffer, "%d", t2p->tiff_pagecount);
269+ buflen=snprintf(buffer, sizeof(buffer), "%d", t2p->tiff_pagecount);
270 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
271 written += t2pWriteFile(output, (tdata_t) " \n>> \n", 6);
272
273@@ -4128,28 +4128,28 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
274
275 unsigned int i=0;
276 tsize_t written=0;
277- char buffer[16];
278+ char buffer[256];
279 int buflen=0;
280
281 written += t2pWriteFile(output, (tdata_t) "<<\n/Type /Page \n/Parent ", 24);
282- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
283+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_pages);
284 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
285 written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
286 written += t2pWriteFile(output, (tdata_t) "/MediaBox [", 11);
287- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x1);
288+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x1);
289 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
290 written += t2pWriteFile(output, (tdata_t) " ", 1);
291- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y1);
292+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y1);
293 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
294 written += t2pWriteFile(output, (tdata_t) " ", 1);
295- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x2);
296+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x2);
297 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
298 written += t2pWriteFile(output, (tdata_t) " ", 1);
299- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y2);
300+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y2);
301 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
302 written += t2pWriteFile(output, (tdata_t) "] \n", 3);
303 written += t2pWriteFile(output, (tdata_t) "/Contents ", 10);
304- buflen=sprintf(buffer, "%lu", (unsigned long)(object + 1));
305+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(object + 1));
306 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
307 written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
308 written += t2pWriteFile(output, (tdata_t) "/Resources << \n", 15);
309@@ -4157,15 +4157,13 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
310 written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
311 for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){
312 written += t2pWriteFile(output, (tdata_t) "/Im", 3);
313- buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
314+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
315 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
316 written += t2pWriteFile(output, (tdata_t) "_", 1);
317- buflen = sprintf(buffer, "%u", i+1);
318+ buflen = snprintf(buffer, sizeof(buffer), "%u", i+1);
319 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
320 written += t2pWriteFile(output, (tdata_t) " ", 1);
321- buflen = sprintf(
322- buffer,
323- "%lu",
324+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
325 (unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
326 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
327 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
328@@ -4177,12 +4175,10 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
329 } else {
330 written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
331 written += t2pWriteFile(output, (tdata_t) "/Im", 3);
332- buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
333+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
334 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
335 written += t2pWriteFile(output, (tdata_t) " ", 1);
336- buflen = sprintf(
337- buffer,
338- "%lu",
339+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
340 (unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
341 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
342 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
343@@ -4191,9 +4187,7 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
344 if(t2p->tiff_transferfunctioncount != 0) {
345 written += t2pWriteFile(output, (tdata_t) "/ExtGState <<", 13);
346 t2pWriteFile(output, (tdata_t) "/GS1 ", 5);
347- buflen = sprintf(
348- buffer,
349- "%lu",
350+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
351 (unsigned long)(object + 3));
352 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
353 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
354@@ -4566,7 +4560,7 @@ tsize_t t2p_write_pdf_page_content_stream(T2P* t2p, TIFF* output){
355 if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){
356 for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){
357 box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;
358- buflen=sprintf(buffer,
359+ buflen=snprintf(buffer, sizeof(buffer),
360 "q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\n",
361 t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
362 box.mat[0],
363@@ -4581,7 +4575,7 @@ tsize_t t2p_write_pdf_page_content_stream(T2P* t2p, TIFF* output){
364 }
365 } else {
366 box=t2p->pdf_imagebox;
367- buflen=sprintf(buffer,
368+ buflen=snprintf(buffer, sizeof(buffer),
369 "q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\n",
370 t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
371 box.mat[0],
372@@ -4606,59 +4600,48 @@ tsize_t t2p_write_pdf_xobject_stream_dict(ttile_t tile,
373 TIFF* output){
374
375 tsize_t written=0;
376- char buffer[16];
377+ char buffer[32];
378 int buflen=0;
379
380 written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);
381 written += t2pWriteFile(output,
382 (tdata_t) "/Type /XObject \n/Subtype /Image \n/Name /Im",
383 42);
384- buflen=sprintf(buffer, "%u", t2p->pdf_page+1);
385+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
386 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
387 if(tile != 0){
388 written += t2pWriteFile(output, (tdata_t) "_", 1);
389- buflen=sprintf(buffer, "%lu", (unsigned long)tile);
390+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)tile);
391 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
392 }
393 written += t2pWriteFile(output, (tdata_t) "\n/Width ", 8);
394- _TIFFmemset((tdata_t)buffer, 0x00, 16);
395 if(tile==0){
396- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_width);
397+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_width);
398 } else {
399 if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
400- buflen=sprintf(
401- buffer,
402- "%lu",
403+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
404 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
405 } else {
406- buflen=sprintf(
407- buffer,
408- "%lu",
409+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
410 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
411 }
412 }
413 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
414 written += t2pWriteFile(output, (tdata_t) "\n/Height ", 9);
415- _TIFFmemset((tdata_t)buffer, 0x00, 16);
416 if(tile==0){
417- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_length);
418+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_length);
419 } else {
420 if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
421- buflen=sprintf(
422- buffer,
423- "%lu",
424+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
425 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
426 } else {
427- buflen=sprintf(
428- buffer,
429- "%lu",
430+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
431 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
432 }
433 }
434 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
435 written += t2pWriteFile(output, (tdata_t) "\n/BitsPerComponent ", 19);
436- _TIFFmemset((tdata_t)buffer, 0x00, 16);
437- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
438+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
439 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
440 written += t2pWriteFile(output, (tdata_t) "\n/ColorSpace ", 13);
441 written += t2p_write_pdf_xobject_cs(t2p, output);
442@@ -4702,11 +4685,10 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
443 t2p->pdf_colorspace ^= T2P_CS_PALETTE;
444 written += t2p_write_pdf_xobject_cs(t2p, output);
445 t2p->pdf_colorspace |= T2P_CS_PALETTE;
446- buflen=sprintf(buffer, "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
447+ buflen=snprintf(buffer, sizeof(buffer), "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
448 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
449 written += t2pWriteFile(output, (tdata_t) " ", 1);
450- _TIFFmemset(buffer, 0x00, 16);
451- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_palettecs );
452+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_palettecs );
453 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
454 written += t2pWriteFile(output, (tdata_t) " 0 R ]\n", 7);
455 return(written);
456@@ -4740,10 +4722,10 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
457 X_W /= Y_W;
458 Z_W /= Y_W;
459 Y_W = 1.0F;
460- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
461+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
462 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
463 written += t2pWriteFile(output, (tdata_t) "/Range ", 7);
464- buflen=sprintf(buffer, "[%d %d %d %d] \n",
465+ buflen=snprintf(buffer, sizeof(buffer), "[%d %d %d %d] \n",
466 t2p->pdf_labrange[0],
467 t2p->pdf_labrange[1],
468 t2p->pdf_labrange[2],
469@@ -4759,26 +4741,26 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
470 tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
471
472 tsize_t written=0;
473- char buffer[16];
474+ char buffer[32];
475 int buflen=0;
476
477 written += t2pWriteFile(output, (tdata_t) "<< /Type /ExtGState \n/TR ", 25);
478 if(t2p->tiff_transferfunctioncount == 1){
479- buflen=sprintf(buffer, "%lu",
480+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
481 (unsigned long)(t2p->pdf_xrefcount + 1));
482 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
483 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
484 } else {
485 written += t2pWriteFile(output, (tdata_t) "[ ", 2);
486- buflen=sprintf(buffer, "%lu",
487+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
488 (unsigned long)(t2p->pdf_xrefcount + 1));
489 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
490 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
491- buflen=sprintf(buffer, "%lu",
492+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
493 (unsigned long)(t2p->pdf_xrefcount + 2));
494 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
495 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
496- buflen=sprintf(buffer, "%lu",
497+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
498 (unsigned long)(t2p->pdf_xrefcount + 3));
499 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
500 written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
501@@ -4800,7 +4782,7 @@ tsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16 i){
502 written += t2pWriteFile(output, (tdata_t) "/FunctionType 0 \n", 17);
503 written += t2pWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \n", 19);
504 written += t2pWriteFile(output, (tdata_t) "/Range [0.0 1.0] \n", 18);
505- buflen=sprintf(buffer, "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
506+ buflen=snprintf(buffer, sizeof(buffer), "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
507 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
508 written += t2pWriteFile(output, (tdata_t) "/BitsPerSample 16 \n", 19);
509 written += t2p_write_pdf_stream_dict(((tsize_t)1)<<(t2p->tiff_bitspersample+1), 0, output);
510@@ -4827,7 +4809,7 @@ tsize_t t2p_write_pdf_transfer_stream(T2P* t2p, TIFF* output, uint16 i){
511 tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
512
513 tsize_t written=0;
514- char buffer[128];
515+ char buffer[256];
516 int buflen=0;
517
518 float X_W=0.0;
519@@ -4895,16 +4877,16 @@ tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
520 written += t2pWriteFile(output, (tdata_t) "<< \n", 4);
521 if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
522 written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
523- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
524+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
525 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
526 written += t2pWriteFile(output, (tdata_t) "/Gamma 2.2 \n", 12);
527 }
528 if(t2p->pdf_colorspace & T2P_CS_CALRGB){
529 written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
530- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
531+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
532 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
533 written += t2pWriteFile(output, (tdata_t) "/Matrix ", 8);
534- buflen=sprintf(buffer, "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
535+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
536 X_R, Y_R, Z_R,
537 X_G, Y_G, Z_G,
538 X_B, Y_B, Z_B);
539@@ -4923,11 +4905,11 @@ tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
540 tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
541
542 tsize_t written=0;
543- char buffer[16];
544+ char buffer[32];
545 int buflen=0;
546
547 written += t2pWriteFile(output, (tdata_t) "[/ICCBased ", 11);
548- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_icccs);
549+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_icccs);
550 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
551 written += t2pWriteFile(output, (tdata_t) " 0 R] \n", 7);
552
553@@ -4937,11 +4919,11 @@ tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
554 tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){
555
556 tsize_t written=0;
557- char buffer[16];
558+ char buffer[32];
559 int buflen=0;
560
561 written += t2pWriteFile(output, (tdata_t) "/N ", 3);
562- buflen=sprintf(buffer, "%u \n", t2p->tiff_samplesperpixel);
563+ buflen=snprintf(buffer, sizeof(buffer), "%u \n", t2p->tiff_samplesperpixel);
564 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
565 written += t2pWriteFile(output, (tdata_t) "/Alternate ", 11);
566 t2p->pdf_colorspace ^= T2P_CS_ICCBASED;
567@@ -5006,7 +4988,7 @@ tsize_t t2p_write_pdf_xobject_decode(T2P* t2p, TIFF* output){
568 tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){
569
570 tsize_t written=0;
571- char buffer[16];
572+ char buffer[32];
573 int buflen=0;
574
575 if(t2p->pdf_compression==T2P_COMPRESS_NONE){
576@@ -5021,41 +5003,33 @@ tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output
577 written += t2pWriteFile(output, (tdata_t) "<< /K -1 ", 9);
578 if(tile==0){
579 written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
580- buflen=sprintf(buffer, "%lu",
581+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
582 (unsigned long)t2p->tiff_width);
583 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
584 written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
585- buflen=sprintf(buffer, "%lu",
586+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
587 (unsigned long)t2p->tiff_length);
588 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
589 } else {
590 if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
591 written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
592- buflen=sprintf(
593- buffer,
594- "%lu",
595+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
596 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
597 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
598 } else {
599 written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
600- buflen=sprintf(
601- buffer,
602- "%lu",
603+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
604 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
605 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
606 }
607 if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
608 written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
609- buflen=sprintf(
610- buffer,
611- "%lu",
612+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
613 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
614 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
615 } else {
616 written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
617- buflen=sprintf(
618- buffer,
619- "%lu",
620+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
621 (unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
622 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
623 }
624@@ -5082,21 +5056,17 @@ tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output
625 if(t2p->pdf_compressionquality%100){
626 written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13);
627 written += t2pWriteFile(output, (tdata_t) "<< /Predictor ", 14);
628- _TIFFmemset(buffer, 0x00, 16);
629- buflen=sprintf(buffer, "%u", t2p->pdf_compressionquality%100);
630+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_compressionquality%100);
631 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
632 written += t2pWriteFile(output, (tdata_t) " /Columns ", 10);
633- _TIFFmemset(buffer, 0x00, 16);
634- buflen = sprintf(buffer, "%lu",
635+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
636 (unsigned long)t2p->tiff_width);
637 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
638 written += t2pWriteFile(output, (tdata_t) " /Colors ", 9);
639- _TIFFmemset(buffer, 0x00, 16);
640- buflen=sprintf(buffer, "%u", t2p->tiff_samplesperpixel);
641+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_samplesperpixel);
642 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
643 written += t2pWriteFile(output, (tdata_t) " /BitsPerComponent ", 19);
644- _TIFFmemset(buffer, 0x00, 16);
645- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
646+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
647 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
648 written += t2pWriteFile(output, (tdata_t) ">>\n", 3);
649 }
650@@ -5116,16 +5086,16 @@ tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output
651 tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
652
653 tsize_t written=0;
654- char buffer[21];
655+ char buffer[64];
656 int buflen=0;
657 uint32 i=0;
658
659 written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7);
660- buflen=sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
661+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
662 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
663 written += t2pWriteFile(output, (tdata_t) " \n0000000000 65535 f \n", 22);
664 for (i=0;i<t2p->pdf_xrefcount;i++){
665- sprintf(buffer, "%.10lu 00000 n \n",
666+ snprintf(buffer, sizeof(buffer), "%.10lu 00000 n \n",
667 (unsigned long)t2p->pdf_xrefoffsets[i]);
668 written += t2pWriteFile(output, (tdata_t) buffer, 20);
669 }
670@@ -5149,17 +5119,14 @@ tsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output)
671 snprintf(t2p->pdf_fileid + i, 9, "%.8X", rand());
672
673 written += t2pWriteFile(output, (tdata_t) "trailer\n<<\n/Size ", 17);
674- buflen = sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
675+ buflen = snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
676 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
677- _TIFFmemset(buffer, 0x00, 32);
678 written += t2pWriteFile(output, (tdata_t) "\n/Root ", 7);
679- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_catalog);
680+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_catalog);
681 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
682- _TIFFmemset(buffer, 0x00, 32);
683 written += t2pWriteFile(output, (tdata_t) " 0 R \n/Info ", 12);
684- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_info);
685+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_info);
686 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
687- _TIFFmemset(buffer, 0x00, 32);
688 written += t2pWriteFile(output, (tdata_t) " 0 R \n/ID[<", 11);
689 written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
690 sizeof(t2p->pdf_fileid) - 1);
691@@ -5167,9 +5134,8 @@ tsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output)
692 written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
693 sizeof(t2p->pdf_fileid) - 1);
694 written += t2pWriteFile(output, (tdata_t) ">]\n>>\nstartxref\n", 16);
695- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_startxref);
696+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_startxref);
697 written += t2pWriteFile(output, (tdata_t) buffer, buflen);
698- _TIFFmemset(buffer, 0x00, 32);
699 written += t2pWriteFile(output, (tdata_t) "\n%%EOF\n", 7);
700
701 return(written);
702diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c
703index 3330750..7a9a816 100644
704--- a/tools/tiff2ps.c
705+++ b/tools/tiff2ps.c
706@@ -1789,8 +1789,8 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
707 imageOp = "imagemask";
708
709 (void)strcpy(im_x, "0");
710- (void)sprintf(im_y, "%lu", (long) h);
711- (void)sprintf(im_h, "%lu", (long) h);
712+ (void)snprintf(im_y, sizeof(im_y), "%lu", (long) h);
713+ (void)snprintf(im_h, sizeof(im_h), "%lu", (long) h);
714 tile_width = w;
715 tile_height = h;
716 if (TIFFIsTiled(tif)) {
717@@ -1811,7 +1811,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
718 }
719 if (tile_height < h) {
720 fputs("/im_y 0 def\n", fd);
721- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
722+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h);
723 }
724 } else {
725 repeat_count = tf_numberstrips;
726@@ -1823,7 +1823,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
727 fprintf(fd, "/im_h %lu def\n",
728 (unsigned long) tile_height);
729 (void)strcpy(im_h, "im_h");
730- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
731+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h);
732 }
733 }
734
735diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
736index 9cd5d86..a2443aa 100644
737--- a/tools/tiffcrop.c
738+++ b/tools/tiffcrop.c
739@@ -2077,7 +2077,7 @@ update_output_file (TIFF **tiffout, char *mode, int autoindex,
740 return 1;
741 }
742
743- sprintf (filenum, "-%03d%s", findex, export_ext);
744+ snprintf(filenum, sizeof(filenum), "-%03d%s", findex, export_ext);
745 filenum[14] = '\0';
746 strncat (exportname, filenum, 15);
747 }
748@@ -2230,8 +2230,8 @@ main(int argc, char* argv[])
749
750 /* dump.infilename is guaranteed to be NUL termimated and have 20 bytes
751 fewer than PATH_MAX */
752- memset (temp_filename, '\0', PATH_MAX + 1);
753- sprintf (temp_filename, "%s-read-%03d.%s", dump.infilename, dump_images,
754+ snprintf(temp_filename, sizeof(temp_filename), "%s-read-%03d.%s",
755+ dump.infilename, dump_images,
756 (dump.format == DUMP_TEXT) ? "txt" : "raw");
757 if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL)
758 {
759@@ -2249,8 +2249,8 @@ main(int argc, char* argv[])
760
761 /* dump.outfilename is guaranteed to be NUL termimated and have 20 bytes
762 fewer than PATH_MAX */
763- memset (temp_filename, '\0', PATH_MAX + 1);
764- sprintf (temp_filename, "%s-write-%03d.%s", dump.outfilename, dump_images,
765+ snprintf(temp_filename, sizeof(temp_filename), "%s-write-%03d.%s",
766+ dump.outfilename, dump_images,
767 (dump.format == DUMP_TEXT) ? "txt" : "raw");
768 if ((dump.outfile = fopen(temp_filename, dump.mode)) == NULL)
769 {
770diff --git a/tools/tiffdither.c b/tools/tiffdither.c
771index f2f0f20..4308946 100644
772--- a/tools/tiffdither.c
773+++ b/tools/tiffdither.c
774@@ -260,7 +260,7 @@ main(int argc, char* argv[])
775 TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
776 else
777 CopyField(TIFFTAG_FILLORDER, shortv);
778- sprintf(thing, "Dithered B&W version of %s", argv[optind]);
779+ snprintf(thing, sizeof(thing), "Dithered B&W version of %s", argv[optind]);
780 TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
781 CopyField(TIFFTAG_PHOTOMETRIC, shortv);
782 CopyField(TIFFTAG_ORIENTATION, shortv);
783--
7841.8.3.rc3
785
786