]> granicus.if.org Git - imagemagick/commitdiff
Check for EOF and exit loop
authorCristy <urban-warrior@imagemagick.org>
Wed, 11 May 2016 23:28:33 +0000 (19:28 -0400)
committerCristy <urban-warrior@imagemagick.org>
Wed, 11 May 2016 23:28:33 +0000 (19:28 -0400)
coders/mat.c
coders/wpg.c

index 2c1544250f6130e189f0b54798660f7324fcb1fb..3b5857adccb4195dd611c80166d7b9df721ad5d7 100644 (file)
@@ -525,6 +525,8 @@ int zip_status;
       RelinquishMagickMemory(DecompressBlock);
       (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
         "UnableToUncompressImage","`%s'",clone_info->filename);
+      (void) fclose(mat_file);
+      RelinquishUniqueFileResource(clone_info->filename);
       return NULL;
     }
   /* zip_info.next_out = 8*4;*/
@@ -571,7 +573,7 @@ EraseFile:
     fclose(clone_info->file);
     clone_info->file = NULL;
 UnlinkFile:
-    (void) remove_utf8(clone_info->filename);
+    RelinquishUniqueFileResource(clone_info->filename);
     return NULL;
   }
 
index 68d68c43af40b80f1d0b343736fd8162cc97a756..b6ba8d79fe376284d37220638ceb0e63e79d11d6 100644 (file)
@@ -524,6 +524,8 @@ static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception)
             }
         }
       }
+      if (EOFBlob(image) != MagickFalse)
+        break;
     }
   BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);
   return(y <(ssize_t) image->rows ? -5 : 0);
@@ -662,6 +664,8 @@ static int UnpackWPG2Raster(Image *image,int bpp,ExceptionInfo *exception)
               }
           }
         }
+      if (EOFBlob(image) != MagickFalse)
+        break;
     }
   BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);
   return(0);