]> granicus.if.org Git - imagemagick/commitdiff
Avoid using NULL alpha_image in the JNG decoder.
authorglennrp <glennrp@git.imagemagick.org>
Thu, 9 Apr 2015 16:51:44 +0000 (16:51 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Thu, 9 Apr 2015 16:51:44 +0000 (16:51 +0000)
coders/png.c

index 6dd3a125d735ed21a75427fb4f228230be6cca23..3719185735b530083310380c9742edc4e8513427 100644 (file)
@@ -4393,7 +4393,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
 
         /* Copy IDAT header and chunk data to alpha_image->blob */
 
-        if (image_info->ping == MagickFalse)
+        if (alpha_image != NULL && image_info->ping == MagickFalse)
           {
             if (logging != MagickFalse)
               (void) LogMagickEvent(CoderEvent,GetMagickModule(),
@@ -4418,7 +4418,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
       {
         /* Copy chunk data to alpha_image->blob */
 
-        if (image_info->ping == MagickFalse)
+        if (alpha_image != NULL && image_info->ping == MagickFalse)
           {
             if (logging != MagickFalse)
               (void) LogMagickEvent(CoderEvent,GetMagickModule(),
@@ -4868,8 +4868,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
     page_geometry[MaxTextExtent];
 
   Image
-    *image,
-    *previous;
+    *image;
 
   MagickBooleanType
     logging,
@@ -6353,7 +6352,6 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
           ThrowReaderException(CorruptImageError,"ImproperImageHeader");
       }
 
-    previous=image;
     mng_info->image=image;
     mng_info->mng_type=mng_type;
     mng_info->object_id=object_id;
@@ -6368,11 +6366,9 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
     if (image == (Image *) NULL)
       {
-        if (IsImageObject(previous) != MagickFalse)
-          {
-            (void) DestroyImageList(previous);
-            (void) CloseBlob(previous);
-          }
+        if (logging != MagickFalse)
+          (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+            "exit ReadJNGImage() with error");
 
         MngInfoFreeStruct(mng_info,&have_mng_structure);
         return((Image *) NULL);