File ImageMagick-CVE-2019-17540.patch of Package ImageMagick.30956
Index: ImageMagick-6.8.8-1/coders/ps.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/ps.c
+++ ImageMagick-6.8.8-1/coders/ps.c
@@ -572,9 +572,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 (length > GetBlobSize(image))
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
profile=BlobToStringInfo((const void *) NULL,length);