From: cristy Date: Mon, 2 Sep 2013 20:04:42 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~3341 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e287bbaee17bb627af090e3127082e5a316337e5;p=imagemagick --- diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 0458421dd..4f00054b7 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -878,6 +878,17 @@ static MagickBooleanType GetNormalizedCrossCorrelationDistortion( */ image_statistics=GetImageStatistics(image,exception); reconstruct_statistics=GetImageStatistics(reconstruct_image,exception); + if ((image_statistics == (ChannelStatistics *) NULL) || + (reconstruct_statistics == (ChannelStatistics *) NULL)) + { + if (image_statistics != (ChannelStatistics *) NULL) + image_statistics=(ChannelStatistics *) RelinquishMagickMemory( + image_statistics); + if (reconstruct_statistics != (ChannelStatistics *) NULL) + reconstruct_statistics=(ChannelStatistics *) RelinquishMagickMemory( + reconstruct_statistics); + return(MagickFalse); + } status=MagickTrue; progress=0; for (i=0; i <= MaxPixelChannels; i++) diff --git a/MagickCore/identify.c b/MagickCore/identify.c index 001a88306..7635c9f7b 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -154,9 +154,6 @@ static ChannelStatistics *GetLocationStatistics(const Image *image, ChannelStatistics *channel_statistics; - MagickStatusType - status; - register ssize_t i; @@ -475,6 +472,8 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (limit != (const char *) NULL) max_locations=StringToUnsignedLong(limit); channel_statistics=GetLocationStatistics(image,type,exception); + if (channel_statistics == (ChannelStatistics *) NULL) + return(MagickFalse); colorspace=image->colorspace; if (IsImageGray(image,exception) != MagickFalse) colorspace=GRAYColorspace; @@ -660,6 +659,8 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, depth; channel_statistics=GetImageStatistics(image,exception); + if (channel_statistics == (ChannelStatistics *) NULL) + return(MagickFalse); artifact=GetImageArtifact(image,"identify:features"); if (artifact != (const char *) NULL) { diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index d4b852487..59b2142dc 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -1534,7 +1534,7 @@ MagickExport ChannelStatistics *GetImageStatistics(const Image *image, channel_statistics=(ChannelStatistics *) AcquireQuantumMemory( MaxPixelChannels+1,sizeof(*channel_statistics)); if (channel_statistics == (ChannelStatistics *) NULL) - ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); + return(MagickFalse); (void) ResetMagickMemory(channel_statistics,0,(MaxPixelChannels+1)* sizeof(*channel_statistics)); for (i=0; i <= (ssize_t) MaxPixelChannels; i++) @@ -1671,6 +1671,9 @@ MagickExport ChannelStatistics *GetImageStatistics(const Image *image, channel_statistics[i].mean)*(standard_deviation*standard_deviation* standard_deviation*standard_deviation)-3.0; } + if (y < (ssize_t) image->rows) + channel_statistics=(ChannelStatistics *) RelinquishMagickMemory( + channel_statistics); return(channel_statistics); }