fix bounds check for ctables (thanks Hal)
authorreed <reed@google.com>
Fri, 28 Aug 2015 19:38:04 +0000 (12:38 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 28 Aug 2015 19:38:04 +0000 (12:38 -0700)
BUG=skia:

Review URL: https://codereview.chromium.org/1319973008

src/core/SkColorTable.cpp

index e461a09..ca9a865 100644 (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;
     }