Protect glyph sub-pixel placement against NaN and Inf.
authorHerb Derby <herb@google.com>
Wed, 21 Dec 2016 22:00:06 +0000 (17:00 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 21 Dec 2016 22:29:38 +0000 (22:29 +0000)
BUG=chromium:675106

Change-Id: I3f8f2575ca3d1b02615be00d66cf7a123407c5a3
Reviewed-on: https://skia-review.googlesource.com/6404
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>

src/core/SkFindAndPlaceGlyph.h

index 257528c..4e0c9f1 100644 (file)
@@ -436,6 +436,9 @@ private:
 
         SkPoint findAndPositionGlyph(
             const char** text, SkPoint position, ProcessOneGlyph&& processOneGlyph) override {
+            if (!SkScalarsAreFinite(position.fX, position.fY)) {
+                return position;
+            }
             SkPoint finalPosition = position;
             if (kTextAlignment != SkPaint::kLeft_Align) {
                 // Get the width of an un-sub-pixel positioned glyph for calculating the