]> granicus.if.org Git - imagemagick/commitdiff
Added check for invalid number of frames.
authordirk <dirk@git.imagemagick.org>
Sun, 29 May 2016 06:15:20 +0000 (08:15 +0200)
committerdirk <dirk@git.imagemagick.org>
Sun, 29 May 2016 06:15:20 +0000 (08:15 +0200)
coders/mat.c

index 462bd530ed3c5938cebd2eb666ead2a4953ebf6e..7987dd0e844a3d1ace8ac2deb7495743a919c5b4 100644 (file)
@@ -939,7 +939,9 @@ MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader");
       case 16: z2=z = ReadBlobXXXLong(image2);  /* 4D matrix animation */
          if(z!=3 && z!=1)
             ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported");
-           Frames = ReadBlobXXXLong(image2);
+         Frames = ReadBlobXXXLong(image2);
+         if (Frames == 0)
+           ThrowReaderException(CorruptImageError,"ImproperImageHeader");
          break;
       default: ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported");
     }