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>
This commit is contained in:
Ben Wagner 2017-07-11 14:39:36 -04:00 committed by Skia Commit-Bot
parent 51b2f1b64c
commit 52e4fd98b5

View File

@ -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) {