diff options
author | Ben Wagner <bungeman@google.com> | 2017-07-11 14:39:36 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-12 02:40:35 +0000 |
commit | 52e4fd98b5c6b296e4598f3243a891bc76715590 (patch) | |
tree | 9c14fa544a6d6d2b628364cf2c157794775a074c /src/core/SkPathRef.cpp | |
parent | 51b2f1b64c4d250e15b33ea390b4a95c50afc5dd (diff) |
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 <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r-- | src/core/SkPathRef.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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<SkPathRef>* 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) { |