Index: src/codec/SkBmpCodec.cpp |
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp |
index babb17d32e5902dab1c73c558f9c8247bd18f94e..5616a650a6de0ab75e6fb2789f47eff15b2f3f71 100644 |
--- a/src/codec/SkBmpCodec.cpp |
+++ b/src/codec/SkBmpCodec.cpp |
@@ -432,6 +432,12 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { |
if (kRLE_BmpInputFormat != inputFormat && !inIco) { |
colorType = kIndex_8_SkColorType; |
} |
+ |
+ // Mask bmps must have 16, 24, or 32 bits per pixel. |
+ if (kBitMask_BmpInputFormat == inputFormat) { |
+ SkCodecPrintf("Error: invalid input value of bits per pixel for mask bmp.\n"); |
+ return false; |
+ } |
case 24: |
case 32: |
break; |