]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Fri, 4 May 2018 13:13:13 +0000 (09:13 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 4 May 2018 13:13:13 +0000 (09:13 -0400)
coders/png.c

index 9ed76735bce6a64281fcb69e50d20a267141721a..0bcdcf7212190d97b4ba0be769d5c80a2a8ba4bc 100644 (file)
@@ -4502,7 +4502,14 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
       {
         DestroyJNG(NULL,&color_image,&color_image_info,
           &alpha_image,&alpha_image_info);
-        ThrowReaderException(CorruptImageError,"CorruptImage");
+        ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+      }
+    if (length > GetBlobSize(image))
+      {
+        DestroyJNG(NULL,&color_image,&color_image_info,
+          &alpha_image,&alpha_image_info);
+        ThrowReaderException(CorruptImageError,
+          "InsufficientImageDataInFile");
       }
 
     p=NULL;
@@ -4510,13 +4517,6 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
 
     if (length != 0)
       {
-        if (length > GetBlobSize(image))
-          {
-            DestroyJNG(NULL,&color_image,&color_image_info,
-              &alpha_image,&alpha_image_info);
-            ThrowReaderException(CorruptImageError,
-              "InsufficientImageDataInFile");
-          }
         chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk));
 
         if (chunk == (unsigned char *) NULL)