From 4a25fe5447bfb3a1918a2e9d595928e853b09d2e Mon Sep 17 00:00:00 2001 From: Cristy Date: Mon, 7 Aug 2017 15:09:10 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/653 --- coders/viff.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coders/viff.c b/coders/viff.c index 703035c03..3f971f9a2 100644 --- a/coders/viff.c +++ b/coders/viff.c @@ -511,6 +511,8 @@ static Image *ReadVIFFImage(const ImageInfo *image_info, ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); max_packets=(size_t) (number_pixels*viff_info.number_data_bands); } + if ((bytes_per_pixel*max_packets) > GetBlobSize(image)) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); pixels=(unsigned char *) AcquireQuantumMemory(MagickMax(number_pixels, max_packets),bytes_per_pixel*sizeof(*pixels)); if (pixels == (unsigned char *) NULL) @@ -801,10 +803,12 @@ ModuleExport size_t RegisterVIFFImage(void) entry->decoder=(DecodeImageHandler *) ReadVIFFImage; entry->encoder=(EncodeImageHandler *) WriteVIFFImage; entry->magick=(IsImageFormatHandler *) IsVIFF; + entry->flags|=CoderDecoderSeekableStreamFlag; (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo("VIFF","XV","Khoros Visualization image"); entry->decoder=(DecodeImageHandler *) ReadVIFFImage; entry->encoder=(EncodeImageHandler *) WriteVIFFImage; + entry->flags|=CoderDecoderSeekableStreamFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } -- 2.40.0