diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c index 0c23c1ce..8352fe78 100644 --- a/libtiff/tif_print.c +++ b/libtiff/tif_print.c @@ -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; + } } }