Cherry pick: Don't allow iteration through non-finite points.

Original CL:

    Don't allow iteration through non-finite points.

    Added a unit test too.

    BUG=chromium:756563

    Change-Id: Ic77a89b4a98d1a553877af9807a3d3bdcd077bb9
    Reviewed-on: https://skia-review.googlesource.com/44420
    Commit-Queue: Mike Klein <mtklein@chromium.org>
    Reviewed-by: Mike Reed <reed@google.com>

This cherry picks that to m62 minus its additional unit test, which
had some awkward formatting-based merge conflicts.  Only the change
to SkPathRef.cpp is important here.

Change-Id: Ic3e1fa4244a921064d0c0b8a8afafd72af39df4d
Reviewed-on: https://skia-review.googlesource.com/48043
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/include/private/SkPathRef.h b/include/private/SkPathRef.h
index 6d35308..aa01810 100644
--- a/include/private/SkPathRef.h
+++ b/include/private/SkPathRef.h
@@ -124,6 +124,8 @@
         /** Return the next verb in this iteration of the path. When all
             segments have been visited, return kDone_Verb.
 
+            If any point in the path is non-finite, return kDone_Verb immediately.
+
             @param  pts The points representing the current verb and/or segment
                         This must not be NULL.
             @return The verb for the current segment
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index 5894b05..46f2660 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -298,7 +298,7 @@
             return nullptr;
         }
     }
-    
+
     ref->fBoundsIsDirty = false;
 
     // resetToSize clears fSegmentMask and fIsOval
@@ -691,6 +691,11 @@
     if (fConicWeights) {
       fConicWeights -= 1;  // begin one behind
     }
+
+    // Don't allow iteration through non-finite points.
+    if (!path.isFinite()) {
+        fVerbStop = fVerbs;
+    }
 }
 
 uint8_t SkPathRef::Iter::next(SkPoint pts[4]) {