aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpCodec.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-02-17 11:26:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-17 11:26:56 -0800
commitd9ec32090e95cebc7c1bb7c4fe29bef54629ef2c (patch)
tree84a46f2659fba8fec0645cc936c647f6b5487b6c /src/codec/SkBmpCodec.cpp
parent6b3cf73af525fdbf6fd093304db840bb998e3dd6 (diff)
Do not create BmpMaskCodecs with invalid bits per pixel
Diffstat (limited to 'src/codec/SkBmpCodec.cpp')
-rw-r--r--src/codec/SkBmpCodec.cpp6
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;