]> granicus.if.org Git - imagemagick/commitdiff
Fixed size of memory allocation to avoid segfault (Github: #32).
authordirk <dirk@git.imagemagick.org>
Thu, 17 Sep 2015 20:35:27 +0000 (22:35 +0200)
committerdirk <dirk@git.imagemagick.org>
Thu, 17 Sep 2015 20:35:27 +0000 (22:35 +0200)
coders/rle.c

index 05da9aa97beca3bc5e0c83df02e13e4cab7831a2..123ff8abd6ee5828fb59330a47de745f36faf196 100644 (file)
@@ -201,10 +201,7 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
   image=AcquireImage(image_info,exception);
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == MagickFalse)
-    {
-      image=DestroyImageList(image);
-      return((Image *) NULL);
-    }
+    return(DestroyImageList(image));
   /*
     Determine if this a RLE file.
   */
@@ -313,7 +310,7 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
     number_pixels=(MagickSizeType) image->columns*image->rows;
     if ((number_pixels*number_planes) != (size_t) (number_pixels*number_planes))
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-    pixel_info_length=image->columns*image->rows*MagickMax(number_planes,4);
+    pixel_info_length=image->columns*image->rows*number_planes;
     pixel_info=AcquireVirtualMemory(pixel_info_length,sizeof(*pixels));
     if (pixel_info == (MemoryInfo *) NULL)
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");