Do not create BmpMaskCodecs with invalid bits per pixel

BUG=skia:4962
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1704063002

Review URL: https://codereview.chromium.org/1704063002
This commit is contained in:
msarett 2016-02-17 11:26:55 -08:00 committed by Commit bot
parent 6b3cf73af5
commit d9ec32090e

View File

@ -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;