handle text error in pictureplayback

Bug: skia:7476
Change-Id: Iae78ea9c446681e7c2459ed9083a8f76a26e3c48
Reviewed-on: https://skia-review.googlesource.com/92622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-01-09 13:45:12 -05:00 committed by Skia Commit-Bot
parent 17b7c05433
commit 4d91e3091d

View File

@ -78,8 +78,12 @@ public:
fByteLength = reader->readInt();
fText = (const char*)reader->skip(fByteLength);
if (reader->isValid()) {
fCount = SkPaintPriv::ValidCountText(fText, fByteLength, paint->getTextEncoding());
reader->validate(fCount >= 0);
if (fByteLength == 0) {
fCount = 0;
} else {
fCount = SkPaintPriv::ValidCountText(fText, fByteLength, paint->getTextEncoding());
reader->validate(fCount > 0);
}
}
}
}