Check for valid input to text draw.

Bug: oss-fuzz:8821
Change-Id: I170b64f97cd7189f8dbe3982b8dcc47afcb14cde
Reviewed-on: https://skia-review.googlesource.com/155940
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
Jim Van Verth 2018-09-20 15:13:22 -04:00 committed by Skia Commit-Bot
parent f3ebd312f2
commit c79b5dd351

View File

@ -305,6 +305,11 @@ bool SkBaseDevice::peekPixels(SkPixmap* pmap) {
void SkBaseDevice::drawGlyphRunRSXform(SkGlyphRun* run, const SkRSXform* xform) {
const SkMatrix originalCTM = this->ctm();
if (!originalCTM.isFinite() || !SkScalarIsFinite(run->paint().getTextSize()) ||
!SkScalarIsFinite(run->paint().getTextScaleX()) ||
!SkScalarIsFinite(run->paint().getTextSkewX())) {
return;
}
sk_sp<SkShader> shader = sk_ref_sp(run->mutablePaint()->getShader());
auto perGlyph = [this, &xform, &originalCTM, shader] (
SkGlyphRun* glyphRun, SkPaint* runPaint) {