Fix an assert in SkBmpCodec::ReadHeader

Bug: chromium:897389

The comment seems to imply that infoBytesRemaining should be at least 52
(inclusive). This matches the code below (we read 4 bytes starting at
offset 48). In addition, since this must be one of
kInfoV3_BmpHeaderType, kInfoV4_BmpHeaderType, or kInfoV5_BmpHeaderType,
It is valid for infoBytesRemaining to be 52 (and no less).

Change-Id: I330460f1eb5d372feb622588e26ea3f3a8ddad1e
Reviewed-on: https://skia-review.googlesource.com/c/164604
Commit-Queue: Leon Scroggins <scroggo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Leon Scroggins III 2018-10-23 11:17:38 -04:00 committed by Skia Commit-Bot
parent 036312f22f
commit 57862f6833

View File

@ -374,7 +374,7 @@ SkCodec::Result SkBmpCodec::ReadHeader(SkStream* stream, bool inIco,
//
// Header types are matched based on size. If the header is
// V3+, we are guaranteed to be able to read at least this size.
SkASSERT(infoBytesRemaining > 52);
SkASSERT(infoBytesRemaining >= 52);
inputMasks.alpha = get_int(iBuffer.get(), 48);
break;
case kOS2VX_BmpHeaderType: