From cdafbc753cf794160eb53b320d4bc0b36ba6ed1d Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 7 May 2017 09:53:16 +0200 Subject: [PATCH] Fix moment when quantum info is acquired to fix issue reported in #469. --- coders/mat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coders/mat.c b/coders/mat.c index 48cde36e2..13f03849d 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -1091,9 +1091,6 @@ RestoreMSCWarning (void) sample_size; image->columns = MATLAB_HDR.SizeX; image->rows = MATLAB_HDR.SizeY; - quantum_info=AcquireQuantumInfo(clone_info,image); - if (quantum_info == (QuantumInfo *) NULL) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); one=1; image->colors = one << image->depth; if (image->columns == 0 || image->rows == 0) @@ -1121,6 +1118,9 @@ RestoreMSCWarning status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); + quantum_info=AcquireQuantumInfo(clone_info,image); + if (quantum_info == (QuantumInfo *) NULL) + ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* ----- Load raster data ----- */ BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */ -- 2.50.1