File ImageMagick-CVE-2018-12599.patch of Package ImageMagick.8117

diff --git a/coders/bmp.c b/coders/bmp.c
index ad31da172..ba3d4f9fc 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -969,8 +969,8 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if ((bmp_info.compression == BI_RGB) ||
         (bmp_info.compression == BI_BITFIELDS))
       {
-        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);
@@ -990,8 +990,8 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
         /*
           Convert run-length encoded raster pixels.
         */
-        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);
@@ -1857,8 +1857,8 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image)
     /*
       Convert MIFF to BMP raster pixels.
     */
-    pixel_info=AcquireVirtualMemory((size_t) bmp_info.image_size,
-      sizeof(*pixels));
+    pixel_info=AcquireVirtualMemory(image->rows,MagickMax(bytes_per_line,
+      image->columns+256UL)*sizeof(*pixels));
     if (pixel_info == (MemoryInfo *) NULL)
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
openSUSE Build Service is sponsored by