diff options
author | msarett <msarett@google.com> | 2016-02-17 11:26:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-17 11:26:56 -0800 |
commit | d9ec32090e95cebc7c1bb7c4fe29bef54629ef2c (patch) | |
tree | 84a46f2659fba8fec0645cc936c647f6b5487b6c /src/codec/SkBmpCodec.cpp | |
parent | 6b3cf73af525fdbf6fd093304db840bb998e3dd6 (diff) |
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
Diffstat (limited to 'src/codec/SkBmpCodec.cpp')
-rw-r--r-- | src/codec/SkBmpCodec.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp index babb17d32e..5616a650a6 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; |