]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/99
authorCristy <urban-warrior@imagemagick.org>
Sun, 24 Jan 2016 22:43:46 +0000 (17:43 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sun, 24 Jan 2016 22:43:46 +0000 (17:43 -0500)
coders/viff.c

index 27d1412b2b8081d0ec37793821950b4274294b65..2c72812280a11e9894300b7fce734288b057160b 100644 (file)
@@ -502,8 +502,8 @@ static Image *ReadVIFFImage(const ImageInfo *image_info,
       max_packets=((image->columns+7UL) >> 3UL)*image->rows;
     else
       max_packets=(size_t) (number_pixels*viff_info.number_data_bands);
-    pixels=(unsigned char *) AcquireQuantumMemory(max_packets,
-      bytes_per_pixel*sizeof(*pixels));
+    pixels=(unsigned char *) AcquireQuantumMemory(MagickMax(number_pixels,
+      max_packets),bytes_per_pixel*sizeof(*pixels));
     if (pixels == (unsigned char *) NULL)
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
     count=ReadBlob(image,bytes_per_pixel*max_packets,pixels);