Skip to content

Commit

Permalink
restrict rows/columns to one keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Jul 2, 2022
1 parent 7615041 commit 5dcfcf4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions coders/miff.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,14 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
image->colorspace=(ColorspaceType) colorspace;
break;
}
if (LocaleCompare(keyword,"columns") == 0)
{
if (image->columns != 0)
ThrowReaderException(CorruptImageError,
"ImproperImageHeader");
image->columns=StringToUnsignedLong(options);
break;
}
if (LocaleCompare(keyword,"compression") == 0)
{
ssize_t
Expand All @@ -739,11 +747,6 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
image->compression=(CompressionType) compression;
break;
}
if (LocaleCompare(keyword,"columns") == 0)
{
image->columns=StringToUnsignedLong(options);
break;
}
(void) SetImageProperty(image,keyword,options);
break;
}
Expand Down Expand Up @@ -1003,6 +1006,9 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
}
if (LocaleCompare(keyword,"rows") == 0)
{
if (image->rows != 0)
ThrowReaderException(CorruptImageError,
"ImproperImageHeader");
image->rows=StringToUnsignedLong(options);
break;
}
Expand Down

0 comments on commit 5dcfcf4

Please sign in to comment.