]> granicus.if.org Git - imagemagick/commitdiff
Added check to avoid use of uninitialized value.
authorDirk Lemstra <dirk@git.imagemagick.org>
Thu, 11 Jan 2018 22:50:42 +0000 (23:50 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Thu, 11 Jan 2018 22:50:42 +0000 (23:50 +0100)
Credit to OSS-Fuzz

coders/pgx.c

index 81165a63758a24b6538210191b8f12a37c27de50..dc91462e2095104eb18c71c0139e2e514847c5f2 100644 (file)
@@ -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;