Skip to content

Commit

Permalink
optimize check
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Dec 13, 2024
1 parent 07a679d commit 9ba1c43
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions coders/bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,12 +843,11 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
bmp_info.blue_mask=ReadBlobLSBLong(image);
if (bmp_info.compression == BI_ALPHABITFIELDS)
bmp_info.alpha_mask=ReadBlobLSBLong(image);
if ((bmp_info.size == 40) ||
(bmp_info.compression == BI_ALPHABITFIELDS))
if ((bmp_info.bits_per_pixel != 16) &&
(bmp_info.bits_per_pixel != 32))
ThrowReaderException(CorruptImageError,
"UnsupportedBitsPerPixel");
if (((bmp_info.size == 40) ||
(bmp_info.compression == BI_ALPHABITFIELDS)) &&
(bmp_info.bits_per_pixel != 16) &&
(bmp_info.bits_per_pixel != 32))
ThrowReaderException(CorruptImageError,"UnsupportedBitsPerPixel");
}
if (bmp_info.size > 40)
{
Expand Down

0 comments on commit 9ba1c43

Please sign in to comment.