From 7021b7530ff537f1bf2124686b315df32f007a09 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 13 Jan 2018 19:50:56 -0500 Subject: [PATCH] ... --- coders/bmp.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/coders/bmp.c b/coders/bmp.c index 1b54d5bbb..0721fbe9d 100644 --- a/coders/bmp.c +++ b/coders/bmp.c @@ -1053,31 +1053,63 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) */ if (bmp_info.red_mask != 0) while (((bmp_info.red_mask << shift.red) & 0x80000000UL) == 0) + { shift.red++; + if (shift.red >= 32U) + break; + } if (bmp_info.green_mask != 0) while (((bmp_info.green_mask << shift.green) & 0x80000000UL) == 0) + { shift.green++; + if (shift.green >= 32U) + break; + } if (bmp_info.blue_mask != 0) while (((bmp_info.blue_mask << shift.blue) & 0x80000000UL) == 0) + { shift.blue++; + if (shift.blue >= 32U) + break; + } if (bmp_info.alpha_mask != 0) while (((bmp_info.alpha_mask << shift.alpha) & 0x80000000UL) == 0) + { shift.alpha++; + if (shift.alpha >= 32U) + break; + } sample=shift.red; while (((bmp_info.red_mask << sample) & 0x80000000UL) != 0) + { sample++; + if (sample >= 32U) + break; + } quantum_bits.red=(MagickRealType) (sample-shift.red); sample=shift.green; while (((bmp_info.green_mask << sample) & 0x80000000UL) != 0) + { sample++; + if (sample >= 32U) + break; + } quantum_bits.green=(MagickRealType) (sample-shift.green); sample=shift.blue; while (((bmp_info.blue_mask << sample) & 0x80000000UL) != 0) + { sample++; + if (sample >= 32U) + break; + } quantum_bits.blue=(MagickRealType) (sample-shift.blue); sample=shift.alpha; while (((bmp_info.alpha_mask << sample) & 0x80000000UL) != 0) + { sample++; + if (sample >= 32U) + break; + } quantum_bits.alpha=(MagickRealType) (sample-shift.alpha); } switch (bmp_info.bits_per_pixel) -- 2.40.0