From: Cristy Date: Wed, 20 Jun 2018 00:37:56 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/1178 X-Git-Tag: 7.0.8-3~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=921f208c2ea3cc45847f380257f270ff424adfff;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/1178 --- diff --git a/coders/dib.c b/coders/dib.c index f6399bf20..6b2ecc061 100644 --- a/coders/dib.c +++ b/coders/dib.c @@ -663,8 +663,8 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) dib_info.bits_per_pixel<<=1; bytes_per_line=4*((image->columns*dib_info.bits_per_pixel+31)/32); length=bytes_per_line*image->rows; - pixel_info=AcquireVirtualMemory((size_t) image->rows,MagickMax( - bytes_per_line,image->columns+256UL)*sizeof(*pixels)); + pixel_info=AcquireVirtualMemory(image->rows,MagickMax(bytes_per_line, + image->columns+256UL)*sizeof(*pixels)); if (pixel_info == (MemoryInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); @@ -1178,8 +1178,8 @@ static MagickBooleanType WriteDIBImage(const ImageInfo *image_info,Image *image, /* Convert MIFF to DIB raster pixels. */ - pixels=(unsigned char *) AcquireQuantumMemory(dib_info.image_size, - sizeof(*pixels)); + pixels=(unsigned char *) AcquireQuantumMemory(image->rows,MagickMax( + bytes_per_line,image->columns+256UL)*sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); (void) memset(pixels,0,dib_info.image_size);