Fix mask applied to SkPath::fFillType in readFromMemory to fix fuzzer bug
authorrobertphillips <robertphillips@google.com>
Tue, 28 Jun 2016 11:54:54 +0000 (04:54 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 28 Jun 2016 11:54:54 +0000 (04:54 -0700)
The fFillType field only needs/uses 2 bits - not all 8

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2099113004

Review-Url: https://codereview.chromium.org/2099113004

src/core/SkPath.cpp

index f5b53fc..50789b4 100644 (file)
@@ -2058,7 +2058,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) {
     }
 
     fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF;
-    fFillType = (packed >> kFillType_SerializationShift) & 0xFF;
+    fFillType = (packed >> kFillType_SerializationShift) & 0x3;
     uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3;
     fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1;
     SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer);