From 997c044e599cdb084b6a4bd6cf2fd189b1419d8c Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 3 Jun 2014 11:11:04 +0000 Subject: [PATCH] --- coders/tiff.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/coders/tiff.c b/coders/tiff.c index bab1f7645..7680176cb 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -574,18 +574,16 @@ static void TIFFGetProfiles(TIFF *tiff,Image *image,ExceptionInfo *exception) unsigned char *profile; -#if defined(TIFFTAG_ICCPROFILE) length=0; +#if defined(TIFFTAG_ICCPROFILE) if (TIFFGetField(tiff,TIFFTAG_ICCPROFILE,&length,&profile) == 1) (void) ReadProfile(image,"icc",profile,(ssize_t) length,exception); #endif #if defined(TIFFTAG_PHOTOSHOP) - length=0; if (TIFFGetField(tiff,TIFFTAG_PHOTOSHOP,&length,&profile) == 1) (void) ReadProfile(image,"8bim",profile,(ssize_t) length,exception); #endif #if defined(TIFFTAG_RICHTIFFIPTC) - length=0; if (TIFFGetField(tiff,TIFFTAG_RICHTIFFIPTC,&length,&profile) == 1) { if (TIFFIsByteSwapped(tiff) != 0) @@ -594,11 +592,9 @@ static void TIFFGetProfiles(TIFF *tiff,Image *image,ExceptionInfo *exception) } #endif #if defined(TIFFTAG_XMLPACKET) - length=0; if (TIFFGetField(tiff,TIFFTAG_XMLPACKET,&length,&profile) == 1) (void) ReadProfile(image,"xmp",profile,(ssize_t) length,exception); #endif - length=0; if (TIFFGetField(tiff,37724,&length,&profile) == 1) (void) ReadProfile(image,"tiff:37724",profile,(ssize_t) length,exception); if (TIFFGetField(tiff,34118,&length,&profile) == 1) @@ -891,6 +887,9 @@ static Image *ReadTIFFImage(const ImageInfo *image_info, Image *image; + int + tiff_status; + MagickBooleanType associated_alpha, debug, @@ -1117,13 +1116,19 @@ RestoreMSCWarning TIFFGetEXIFProperties(tiff,image,exception); (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel); - (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units); if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XRESOLUTION,&x_resolution) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YRESOLUTION,&y_resolution) == 1)) { image->resolution.x=x_resolution; image->resolution.y=y_resolution; } + if (TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units) == 1) + { + if (units == RESUNIT_INCH) + image->units=PixelsPerInchResolution; + if (units == RESUNIT_CENTIMETER) + image->units=PixelsPerCentimeterResolution; + } if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position) == 1)) { @@ -1173,11 +1178,16 @@ RestoreMSCWarning char sampling_factor[MaxTextExtent]; + int + tiff_status; + uint16 horizontal, vertical; - if (TIFFGetFieldDefaulted(tiff,TIFFTAG_YCBCRSUBSAMPLING,&horizontal,&vertical) == 1) + tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_YCBCRSUBSAMPLING, + &horizontal,&vertical); + if (tiff_status == 1) { (void) FormatLocaleString(sampling_factor,MaxTextExtent,"%dx%d", horizontal,vertical); @@ -1237,7 +1247,9 @@ RestoreMSCWarning break; } associated_alpha=MagickFalse; - if (TIFFGetFieldDefaulted(tiff,TIFFTAG_EXTRASAMPLES,&extra_samples,&sample_info) == 1) + tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_EXTRASAMPLES,&extra_samples, + &sample_info); + if (tiff_status == 1) { if (extra_samples == 0) { @@ -1273,10 +1285,6 @@ RestoreMSCWarning ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } } - if (units == RESUNIT_INCH) - image->units=PixelsPerInchResolution; - if (units == RESUNIT_CENTIMETER) - image->units=PixelsPerCentimeterResolution; value=(unsigned short) image->scene; if (TIFFGetFieldDefaulted(tiff,TIFFTAG_PAGENUMBER,&value,&pages) == 1) image->scene=value; @@ -1331,6 +1339,9 @@ RestoreMSCWarning if ((image->storage_class == PseudoClass) && (photometric == PHOTOMETRIC_PALETTE)) { + int + tiff_status; + size_t range; @@ -1342,7 +1353,9 @@ RestoreMSCWarning /* Initialize colormap. */ - if (TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap,&green_colormap,&blue_colormap) == 1) + tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap, + &green_colormap,&blue_colormap); + if (tiff_status == 1) { if ((red_colormap != (uint16 *) NULL) && (green_colormap != (uint16 *) NULL) && -- 2.40.0