File ImageMagick-CVE-2019-17540.patch of Package ImageMagick.30356
Index: ImageMagick-7.0.7-34/coders/ps.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/ps.c
+++ ImageMagick-7.0.7-34/coders/ps.c
@@ -953,9 +953,9 @@ static Image *ReadPSImage(const ImageInf
Read Photoshop profile.
*/
count=(ssize_t) sscanf(command,PhotoshopProfile " %lu",&extent);
- if (count != 1)
+ if ((count != 1) || (extent == 0))
continue;
- length=extent;
+ length=(size_t) extent;
if ((MagickSizeType) length > GetBlobSize(image))
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
profile=BlobToStringInfo((const void *) NULL,length);