]> granicus.if.org Git - imagemagick/commitdiff
https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=29710
authorCristy <urban-warrior@imagemagick.org>
Tue, 17 May 2016 19:07:13 +0000 (15:07 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 17 May 2016 19:07:13 +0000 (15:07 -0400)
coders/rle.c

index f03e2cd2ef91e019f294204d2d12cc168a9706b7..59e2411942d92b08e767e9a6fa498a664b051205 100644 (file)
@@ -316,10 +316,11 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
          number_planes_filled))
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
     pixel_info=AcquireVirtualMemory(image->columns,image->rows*
-      number_planes_filled*sizeof(*pixels));
+      MagickMax(number_planes_filled,4)*sizeof(*pixels));
     if (pixel_info == (MemoryInfo *) NULL)
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-    pixel_info_length=image->columns*image->rows*number_planes_filled;
+    pixel_info_length=image->columns*image->rows*
+      MagickMax(number_planes_filled,4);
     pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
     if ((flags & 0x01) && !(flags & 0x02))
       {