From: Cristy Date: Sun, 4 Feb 2018 20:54:36 +0000 (-0500) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5674 X-Git-Tag: 7.0.7-23~134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=206681098213b5494f2f8e17a48caecf60494d3f;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5674 --- diff --git a/coders/tim.c b/coders/tim.c index f6d69f3ec..6d1da3220 100644 --- a/coders/tim.c +++ b/coders/tim.c @@ -223,9 +223,6 @@ static Image *ReadTIMImage(const ImageInfo *image_info,ExceptionInfo *exception) if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; - status=SetImageExtent(image,image->columns,image->rows,exception); - if (status == MagickFalse) - return(DestroyImageList(image)); /* Read image data. */ @@ -239,6 +236,11 @@ static Image *ReadTIMImage(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); bytes_per_line=width*2; width=(width*16)/bits_per_pixel; + image->columns=width; + image->rows=height; + status=SetImageExtent(image,image->columns,image->rows,exception); + if (status == MagickFalse) + return(DestroyImageList(image)); tim_pixels=(unsigned char *) AcquireQuantumMemory(image_size, sizeof(*tim_pixels)); if (tim_pixels == (unsigned char *) NULL) @@ -249,11 +251,6 @@ static Image *ReadTIMImage(const ImageInfo *image_info,ExceptionInfo *exception) tim_pixels=(unsigned char *) RelinquishMagickMemory(tim_pixels); ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); } - /* - Initialize image structure. - */ - image->columns=width; - image->rows=height; /* Convert TIM raster image to pixel packets. */ @@ -460,7 +457,6 @@ ModuleExport size_t RegisterTIMImage(void) entry=AcquireMagickInfo("TIM","TIM","PSX TIM"); entry->decoder=(DecodeImageHandler *) ReadTIMImage; - entry->flags|=CoderDecoderSeekableStreamFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); }