From: Cristy Date: Wed, 1 Aug 2018 20:45:26 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.8-9~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2c3bc12d7371bf3193e488b90d7f6c61907c43f;p=imagemagick ... --- diff --git a/coders/wpg.c b/coders/wpg.c index 62b761ed6..2f3f7a871 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -795,22 +795,25 @@ static Image *ExtractPostscript(Image *image,const ImageInfo *image_info, if (SeekBlob(image,PS_Offset,SEEK_SET) != PS_Offset) { (void) fclose(ps_file); - DestroyImageInfo(clone_info); - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + ThrowException(exception,CorruptImageError,"ImproperImageHeader", + image->filename); + goto FINISH_UNL; } count=ReadBlob(image, 2*MagickPathExtent, magick); if (count < 1) { (void) fclose(ps_file); - DestroyImageInfo(clone_info); - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + ThrowException(exception,CorruptImageError,"ImproperImageHeader", + image->filename); + goto FINISH_UNL; } if (SeekBlob(image,PS_Offset,SEEK_SET) != PS_Offset) { (void) fclose(ps_file); - DestroyImageInfo(clone_info); - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + ThrowException(exception,CorruptImageError,"ImproperImageHeader", + image->filename); + goto FINISH_UNL; } while (PS_Size-- > 0) { @@ -818,8 +821,9 @@ static Image *ExtractPostscript(Image *image,const ImageInfo *image_info, if (c == EOF) { (void) fclose(ps_file); - DestroyImageInfo(clone_info); - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + ThrowException(exception,CorruptImageError,"ImproperImageHeader", + image->filename); + goto FINISH_UNL; } (void) fputc(c,ps_file); } @@ -831,12 +835,13 @@ static Image *ExtractPostscript(Image *image,const ImageInfo *image_info, /* printf("Detected:%s \n",magic_info->name); */ if(exception->severity != UndefinedException) goto FINISH_UNL; if(magic_info->name == (char *) NULL) goto FINISH_UNL; - if (LocaleCompare(magic_info->name,"WPG") == 0) - goto FINISH_UNL; - (void) strncpy(clone_info->magick,magic_info->name,MagickPathExtent-1); - if (LocaleCompare(image_info->magick,clone_info->magick) == 0) - (void) strcpy(clone_info->magick,"PS"); + if (LocaleCompare(clone_info->magick,"PFB") != 0) + { + ThrowException(exception,CorruptImageError,"ImproperImageHeader", + image->filename); + goto FINISH_UNL; + } /* Read nested image */ /*FormatString(clone_info->filename,"%s:%s",magic_info->name,postscript_file);*/