Check for JPEGTables tag presence before copying.

This commit is contained in:
Andrey Kiselev 2005-05-17 14:18:48 +00:00
parent 3a6e371160
commit 53fb873cc2

View File

@ -1,4 +1,4 @@
/* $Id: tiffsplit.c,v 1.9 2004-06-05 08:11:26 dron Exp $ */
/* $Id: tiffsplit.c,v 1.10 2005-05-17 14:18:48 dron Exp $ */
/*
* Copyright (c) 1992-1997 Sam Leffler
@ -151,10 +151,12 @@ tiffcp(TIFF* in, TIFF* out)
CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
CopyField(TIFFTAG_COMPRESSION, compression);
if (compression == COMPRESSION_JPEG) {
uint16 count;
void *table;
TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table);
TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table);
uint16 count = 0;
void *table = NULL;
if (TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table)
&& count > 0 && table) {
TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table);
}
}
CopyField(TIFFTAG_PHOTOMETRIC, shortv);
CopyField(TIFFTAG_PREDICTOR, shortv);