From 52e4fd98b5c6b296e4598f3243a891bc76715590 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 11 Jul 2017 14:39:36 -0400 Subject: [PATCH] Check first deserialized verb of path is a move. SkPathRef::Iter::next and several other bits of code depend on the first verb of a path always being a move. Contructors and builders currently enforce this, so the deserializer must do so also. BUG=chromium:740789 Change-Id: Iad0f6fc6d2b2fe40064c674fa7dd1612c120bb8f Reviewed-on: https://skia-review.googlesource.com/22216 Commit-Queue: Ben Wagner Reviewed-by: Mike Reed --- src/core/SkPathRef.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index f0fda2703b..3338225391 100644 --- a/src/core/SkPathRef.cpp +++ b/src/core/SkPathRef.cpp @@ -190,6 +190,11 @@ void SkPathRef::CreateTransformedCopy(sk_sp* dst, // or if an invalid verb is encountered, return false. static bool deduce_pts_conics(const uint8_t verbs[], int vCount, int* ptCountPtr, int* conicCountPtr) { + // When there is at least one verb, the first is required to be kMove_Verb. + if (0 < vCount && verbs[vCount-1] != SkPath::kMove_Verb) { + return false; + } + int ptCount = 0; int conicCount = 0; for (int i = 0; i < vCount; ++i) {