]> granicus.if.org Git - imagemagick/commitdiff
https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30506
authorCristy <urban-warrior@imagemagick.org>
Tue, 20 Sep 2016 16:09:01 +0000 (12:09 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 20 Sep 2016 16:09:01 +0000 (12:09 -0400)
coders/dib.c

index cc4dd3af989b6b060893fb6ba2e2ab4cbabdbdd8..30ae752eb197c8c1a69bd051fb8125407632fa2a 100644 (file)
@@ -648,7 +648,10 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception)
     {
       count=ReadBlob(image,length,pixels);
       if (count != (ssize_t) (length))
-        ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+        {
+          pixel_info=RelinquishVirtualMemory(pixel_info);
+          ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+        }
     }
   else
     {
@@ -658,7 +661,11 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception)
       status=DecodeImage(image,dib_info.compression ? MagickTrue : MagickFalse,
         pixels);
       if (status == MagickFalse)
-        ThrowReaderException(CorruptImageError,"UnableToRunlengthDecodeImage");
+        {
+          pixel_info=RelinquishVirtualMemory(pixel_info);
+          ThrowReaderException(CorruptImageError,
+            "UnableToRunlengthDecodeImage");
+        }
     }
   /*
     Initialize image structure.
@@ -877,6 +884,7 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception)
       break;
     }
     default:
+      pixel_info=RelinquishVirtualMemory(pixel_info);
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   }
   pixel_info=RelinquishVirtualMemory(pixel_info);