Commit a5268469a for imagemagick.org
commit a5268469a02666d118085b182565436554d8ce54
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Sun May 24 18:29:42 2026 +0200
Close the blob before the dimensions are checked.
diff --git a/coders/dcm.c b/coders/dcm.c
index 8b027f8a0..ec6855795 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -4376,10 +4376,10 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
RelinquishDCMMemory(&info,&map,stream_info,stack,data);
if (image == (Image *) NULL)
return(image);
- if ((image->rows == 0) || (image->columns == 0))
- ThrowReaderException(CorruptImageError,"ImproperImageHeader")
if (CloseBlob(image) == MagickFalse)
status=MagickFalse;
+ if ((image->rows == 0) || (image->columns == 0))
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader")
if (status == MagickFalse)
return(DestroyImageList(image));
return(GetFirstImageInList(image));