Skip to content
Permalink
Browse files

Fixed check for the number of pixels that will be allocated.

  • Loading branch information...
dlemstra committed Oct 5, 2015
1 parent 70aa59b commit 2ad6d33493750a28a5a655d319a8e0b16c392de1
Showing with 6 additions and 2 deletions.
  1. +6 −2 coders/rle.c
@@ -173,6 +173,7 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
map_length,
number_colormaps,
number_planes,
number_planes_filled,
one,
offset,
pixel_info_length;
@@ -308,9 +309,12 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
if (image->alpha_trait != UndefinedPixelTrait)
number_planes++;
number_pixels=(MagickSizeType) image->columns*image->rows;
if ((number_pixels*number_planes) != (size_t) (number_pixels*number_planes))
number_planes_filled=(number_planes % 2 == 0) ? number_planes :
number_planes+1;
if ((number_pixels*number_planes_filled) != (size_t) (number_pixels*
number_planes_filled))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
pixel_info_length=image->columns*image->rows*MagickMax(number_planes,4);
pixel_info_length=image->columns*image->rows*number_planes_filled;
pixel_info=AcquireVirtualMemory(pixel_info_length,sizeof(*pixels));
if (pixel_info == (MemoryInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");

0 comments on commit 2ad6d33

Please sign in to comment.
You can’t perform that action at this time.