fix bounds check for ctables (thanks Hal)

BUG=skia:

Review URL: https://codereview.chromium.org/1319973008
This commit is contained in:
reed 2015-08-28 12:38:04 -07:00 committed by Commit bot
parent 5b4c69e555
commit 264873d5a8

View File

@ -36,7 +36,7 @@ SkColorTable::SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc)
: fColors(colors)
, fCount(count)
{
SkASSERT(count > 0 && count <= 255);
SkASSERT(count > 0 && count <= 256);
SkASSERT(colors);
}
@ -108,7 +108,7 @@ SkColorTable* SkColorTable::Create(SkReadBuffer& buffer) {
return new SkColorTable(nullptr, 0);
}
if (count < 0 || count > 255) {
if (count < 0 || count > 256) {
buffer.validate(false);
return nullptr;
}