From e9af08440ac1a5c1583e12a925e7e966a8c1ea64 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Thu, 11 Jan 2018 23:50:42 +0100 Subject: [PATCH] Added check to avoid use of uninitialized value. Credit to OSS-Fuzz --- coders/pgx.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.40.0