From: cristy Date: Wed, 30 Apr 2014 23:37:58 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2377 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c99e4c29c335b33187632b9907abc59d47f69349;p=imagemagick --- diff --git a/coders/pcx.c b/coders/pcx.c index b7d5e80dd..b27cf961a 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -322,6 +322,9 @@ static Image *ReadPCXImage(const ImageInfo *image_info,ExceptionInfo *exception) count=ReadBlob(image,1,&pcx_info.identifier); for (id=1; id < 1024; id++) { + int + bits_per_pixel; + /* Verify PCX identifier. */ @@ -329,7 +332,10 @@ static Image *ReadPCXImage(const ImageInfo *image_info,ExceptionInfo *exception) if ((count == 0) || (pcx_info.identifier != 0x0a)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); pcx_info.encoding=(unsigned char) ReadBlobByte(image); - pcx_info.bits_per_pixel=(unsigned char) ReadBlobByte(image); + bits_per_pixel=ReadBlobByte(image); + if (bits_per_pixel == -1) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + pcx_info.bits_per_pixel=(unsigned char) bits_per_pixel; pcx_info.left=ReadBlobLSBShort(image); pcx_info.top=ReadBlobLSBShort(image); pcx_info.right=ReadBlobLSBShort(image);