From: glennrp Date: Mon, 21 Feb 2011 12:08:18 +0000 (+0000) Subject: Check "count" return while reading the JNG signature. X-Git-Tag: 7.0.1-0~8127 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b8763efd02f5343a141d40636f6a8dfdc2c7682;p=imagemagick Check "count" return while reading the JNG signature. --- diff --git a/coders/png.c b/coders/png.c index 5ae188c1a..4cdd673fb 100644 --- a/coders/png.c +++ b/coders/png.c @@ -3965,9 +3965,8 @@ static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Verify JNG signature. */ count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number); - (void) count; - if (memcmp(magic_number,"\213JNG\r\n\032\n",8) != 0) + if (count < 8 || memcmp(magic_number,"\213JNG\r\n\032\n",8) != 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); /* Allocate a MngInfo structure. */