From: cristy Date: Wed, 7 Jan 2015 12:20:18 +0000 (+0000) Subject: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26843 X-Git-Tag: 7.0.1-0~1482 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3788976d96f9ba0baddec070b0268f95ed12590e;p=imagemagick http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26843 --- diff --git a/coders/miff.c b/coders/miff.c index dce2738d8..68825abfe 100644 --- a/coders/miff.c +++ b/coders/miff.c @@ -561,6 +561,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, /* Get the keyword. */ + length=MaxTextExtent; p=keyword; do { @@ -592,9 +593,6 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, break; p=options+strlen(options); } - if (options == (char *) NULL) - ThrowReaderException(ResourceLimitError, - "MemoryAllocationFailed"); *p++=(char) c; c=ReadBlobByte(image); if (c == '\\') @@ -609,7 +607,11 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, if (*options != '{') if (isspace((int) ((unsigned char) c)) != 0) break; - } } + } + if (options == (char *) NULL) + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); + } *p='\0'; if (*options == '{') (void) CopyMagickString(options,options+1,strlen(options)); diff --git a/coders/mpc.c b/coders/mpc.c index b29657b62..8abd0607f 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -276,6 +276,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Get the keyword. */ + length=MaxTextExtent; p=keyword; do { @@ -307,9 +308,6 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) break; p=options+strlen(options); } - if (options == (char *) NULL) - ThrowReaderException(ResourceLimitError, - "MemoryAllocationFailed"); *p++=(char) c; c=ReadBlobByte(image); if (c == '\\') @@ -325,6 +323,9 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) if (isspace((int) ((unsigned char) c)) != 0) break; } + if (options == (char *) NULL) + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); } *p='\0'; if (*options == '{')