]> granicus.if.org Git - imagemagick/commitdiff
Added extra checks.
authorDirk Lemstra <dirk@lemstra.org>
Sat, 26 Jan 2019 11:59:51 +0000 (12:59 +0100)
committerDirk Lemstra <dirk@lemstra.org>
Sat, 26 Jan 2019 11:59:51 +0000 (12:59 +0100)
coders/psd.c

index ab68c3d9cb556c63da1c5cae03ae24da03d95bbe..9e6a1ab8f2999c06f0715311818929dc5abf7ef5 100644 (file)
@@ -1747,6 +1747,12 @@ static MagickBooleanType ReadPSDLayersInternal(Image *image,
     left=(ssize_t) ReadBlobSignedLong(image);
     bottom=(ssize_t) ReadBlobSignedLong(image);
     right=(ssize_t) ReadBlobSignedLong(image);
+    if ((right < left) || (bottom < top))
+      {
+        layer_info=DestroyLayerInfo(layer_info,number_layers);
+        ThrowBinaryException(CorruptImageError,"ImproperImageHeader",
+          image->filename);
+      }
     layer_info[i].page.y=top;
     layer_info[i].page.x=left;
     layer_info[i].page.width=(size_t) (right-left);