From b67f17367ac8993062eed89b86234a007ff89a1a Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 14 Jul 2018 10:16:36 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1211 --- MagickCore/blob.c | 3 +-- coders/mat.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/MagickCore/blob.c b/MagickCore/blob.c index 8a6b1632e..d2956fef9 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -609,9 +609,8 @@ MagickExport MagickBooleanType CloseBlob(Image *image) assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - assert(image->blob != (BlobInfo *) NULL); blob_info=image->blob; - if (blob_info->type == UndefinedStream) + if ((blob_info == (BlobInfo *) NULL) || (blob_info->type == UndefinedStream)) return(MagickTrue); status=SyncBlob(image); switch (blob_info->type) diff --git a/coders/mat.c b/coders/mat.c index 3be3bcbb8..5858ff534 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -1085,7 +1085,7 @@ MATLAB_KO: MATLAB_HDR.StructureClass != mxINT64_CLASS && MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */ { - if (image2 != (Image*) NULL) + if ((image2 != (Image*) NULL) && (image2 != image)) { CloseBlob(image2); DeleteImageFromList(&image2); -- 2.40.0