]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/652
authorCristy <urban-warrior@imagemagick.org>
Mon, 7 Aug 2017 19:12:56 +0000 (15:12 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 7 Aug 2017 19:12:56 +0000 (15:12 -0400)
coders/bmp.c

index 207118ed10fe430d1b19087b59762ef69288133e..618f9870d5c412f29a1754b6fa5debbf505f62f9 100644 (file)
@@ -942,6 +942,8 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
       bmp_info.bits_per_pixel<<=1;
     bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);
     length=(size_t) bytes_per_line*image->rows;
+    if (length > GetBlobSize(image))
+      ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
     pixel_info=AcquireVirtualMemory((size_t) image->rows,
       MagickMax(bytes_per_line,image->columns+256UL)*sizeof(*pixels));
     if (pixel_info == (MemoryInfo *) NULL)