Properly read TIFFTAG_PAGENUMBER, TIFFTAG_HALFTONEHINTS,

TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE tags as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=1088.
This commit is contained in:
Andrey Kiselev 2006-02-23 15:56:34 +00:00
parent 1146156015
commit 3cdfaeafb1

View File

@ -1,4 +1,4 @@
/* $Id: tif_print.c,v 1.33 2005-12-24 15:36:16 dron Exp $ */
/* $Id: tif_print.c,v 1.34 2006-02-23 15:56:34 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -528,14 +528,21 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
value_count = td->td_samplesperpixel;
else
value_count = fip->field_readcount;
if (fip->field_type == TIFF_ASCII
|| fip->field_readcount == TIFF_VARIABLE
|| fip->field_readcount == TIFF_VARIABLE2
|| fip->field_readcount == TIFF_SPP
|| value_count > 1) {
if ((fip->field_type == TIFF_ASCII
|| fip->field_readcount == TIFF_VARIABLE
|| fip->field_readcount == TIFF_VARIABLE2
|| fip->field_readcount == TIFF_SPP
|| value_count > 1)
&& fip->field_tag != TIFFTAG_PAGENUMBER
&& fip->field_tag != TIFFTAG_HALFTONEHINTS
&& fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
&& fip->field_tag != TIFFTAG_DOTRANGE) {
if(TIFFGetField(tif, tag, &raw_data) != 1)
continue;
} else {
} else if (fip->field_tag != TIFFTAG_PAGENUMBER
&& fip->field_tag != TIFFTAG_HALFTONEHINTS
&& fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
&& fip->field_tag != TIFFTAG_DOTRANGE) {
raw_data = _TIFFmalloc(
_TIFFDataSize(fip->field_type)
* value_count);
@ -544,6 +551,24 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
_TIFFfree(raw_data);
continue;
}
} else {
/*
* XXX: Should be fixed and removed, see the
* notes related to TIFFTAG_PAGENUMBER,
* TIFFTAG_HALFTONEHINTS,
* TIFFTAG_YCBCRSUBSAMPLING and
* TIFFTAG_DOTRANGE tags in tif_dir.c. */
char *tmp;
raw_data = _TIFFmalloc(
_TIFFDataSize(fip->field_type)
* value_count);
tmp = raw_data;
mem_alloc = 1;
if(TIFFGetField(tif, tag, tmp,
tmp + _TIFFDataSize(fip->field_type)) != 1) {
_TIFFfree(raw_data);
continue;
}
}
}