Commit 62c7876c3 for imagemagick.org
commit 62c7876c37347dee0be1872e623650ba59f8a541
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Tue Sep 29 06:33:24 2026 +0200
Added missing cleanup in error path of the MAT decoder (GHSA-83w9-w85j-h9jc)
diff --git a/coders/mat.c b/coders/mat.c
index b1eb1bed0..07a293315 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -1261,7 +1261,13 @@ RestoreMSCWarning
}
if ((image->columns > GetBlobSize(image)) ||
(image->rows > GetBlobSize(image)))
- ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ {
+ if (clone_info != (ImageInfo *) NULL)
+ clone_info=DestroyImageInfo(clone_info);
+ if ((image != image2) && (image2 != (Image *) NULL))
+ image2=DestroyImage(image2);
+ ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ }
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
{