From: Dirk Lemstra Date: Thu, 11 Jan 2018 22:50:42 +0000 (+0100) Subject: Added check to avoid use of uninitialized value. X-Git-Tag: 7.0.7-22~104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e9af08440ac1a5c1583e12a925e7e966a8c1ea64;p=imagemagick Added check to avoid use of uninitialized value. Credit to OSS-Fuzz --- diff --git a/coders/pgx.c b/coders/pgx.c index 81165a637..dc91462e2 100644 --- a/coders/pgx.c +++ b/coders/pgx.c @@ -182,6 +182,8 @@ static Image *ReadPGXImage(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); count=(ssize_t) sscanf(buffer,"PG%[ \t]%2s%[ \t+-]%d%[ \t]%d%[ \t]%d",sans, endian,sign,&precision,sans,&width,sans,&height); + if (count != 8) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); image->depth=(size_t) precision; if (LocaleCompare(endian,"ML") == 0) image->endian=MSBEndian;