From: cristy Date: Sun, 27 Feb 2011 16:51:16 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~8066 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b032003c4fd72eb09c85c2c8ed28fbe8830673c7;p=imagemagick --- diff --git a/coders/psd.c b/coders/psd.c index f515295c4..7163c75aa 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -940,31 +940,13 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) size_t quantum; - unsigned char - *blocks; - /* Skip layers & masks. */ quantum=psd_info.version == 1 ? 4UL : 8UL; - size=ReadBlobMSBLong(image); - length-=(quantum+4); - if (image->debug != MagickFalse) - (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " reading image resource blocks - %.20g bytes",(double) length); - blocks=(unsigned char *) AcquireQuantumMemory((size_t) length, - sizeof(*blocks)); - if (blocks == (unsigned char *) NULL) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - count=ReadBlob(image,(size_t) length,blocks); - if ((count != (ssize_t) length) || - (LocaleNCompare((char *) blocks,"8BIM",4) != 0)) - { - blocks=(unsigned char *) RelinquishMagickMemory(blocks); - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); - } - (void) ParseImageResourceBlocks(image,blocks,(size_t) length); - blocks=(unsigned char *) RelinquishMagickMemory(blocks); + if (DiscardBlobBytes(image,length-quantum) == MagickFalse) + ThrowFileException(exception,CorruptImageError, + "UnexpectedEndOfFile",image->filename); } else {