From e8f8f3877ede9cbc125b64c8f760c7c4a63bc00f Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 1 Sep 2011 13:32:37 +0000 Subject: [PATCH] --- coders/png.c | 9 ++++++++- coders/tiff.c | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/coders/png.c b/coders/png.c index 686fc7773..9be177d7c 100644 --- a/coders/png.c +++ b/coders/png.c @@ -2296,7 +2296,14 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Reading PNG iCCP chunk."); - profile=AcquireStringInfo(profile_length); + profile=BlobToStringInfo(info,profile_length); + if (profile == (StringInfo *) NULL) + { + (void) ThrowMagickException(&image->exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'", + "unable to copy profile"); + return(MagickFalse); + } SetStringInfoDatum(profile,(const unsigned char *) info); (void) SetImageProfile(image,"icc",profile); profile=DestroyStringInfo(profile); diff --git a/coders/tiff.c b/coders/tiff.c index a6b53dba0..b8d4aaa3e 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -459,8 +459,10 @@ static MagickBooleanType ReadProfile(Image *image,const char *name, if (length < 4) return(MagickFalse); } - profile=AcquireStringInfo((size_t) length); - SetStringInfoDatum(profile,datum+i); + profile=BlobToStringInfo(datum+i,(size_t) length); + if (profile == (StringInfo *) NULL) + ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", + image->filename); status=SetImageProfile(image,name,profile); profile=DestroyStringInfo(profile); if (status == MagickFalse) -- 2.40.0