(void) SetImageChannelMask(image,channel_mask);
}
-static MagickBooleanType ParseImageResourceBlocks(Image *image,
+static void ParseImageResourceBlocks(Image *image,
const unsigned char *blocks,size_t length,
MagickBooleanType *has_merged_image,ExceptionInfo *exception)
{
short_sans;
if (length < 16)
- return(MagickFalse);
+ return;
profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,blocks);
(void) SetImageProfile(image,"8bim",profile,exception);
p=PushShortPixel(MSBEndian,p,&id);
p=PushShortPixel(MSBEndian,p,&short_sans);
p=PushLongPixel(MSBEndian,p,&count);
+ if (p+count > blocks+length)
+ return;
switch (id)
{
case 0x03ed:
if ((count & 0x01) != 0)
p++;
}
- return(MagickTrue);
+ return;
}
static CompositeOperator PSDBlendModeToCompositeOperator(const char *mode)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" reading image resource blocks - %.20g bytes",(double)
((MagickOffsetType) length));
- blocks=(unsigned char *) AcquireQuantumMemory((size_t) length+16,
+ blocks=(unsigned char *) AcquireQuantumMemory((size_t) length,
sizeof(*blocks));
if (blocks == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blocks=(unsigned char *) RelinquishMagickMemory(blocks);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
- (void) ParseImageResourceBlocks(image,blocks,(size_t) length,
- &has_merged_image,exception);
+ ParseImageResourceBlocks(image,blocks,(size_t) length,&has_merged_image,
+ exception);
blocks=(unsigned char *) RelinquishMagickMemory(blocks);
}
/*