ccpr: Clamp the number of linear stroke segments

Clamps the number of linear segments before indexing into arrays with
it (oops). Also adds some minor fixups surrounding NaNs.

Bug: skia:8360
Change-Id: Id520ac49df2ebce71bda9fcaa0f164ddb6ddf2d2
Reviewed-on: https://skia-review.googlesource.com/154771
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCCStroker.cpp b/src/gpu/ccpr/GrCCStroker.cpp
index ab3906c..919e0f7 100644
--- a/src/gpu/ccpr/GrCCStroker.cpp
+++ b/src/gpu/ccpr/GrCCStroker.cpp
@@ -476,7 +476,7 @@
 
         // For miter and round joins, we place an additional triangle cap on top of the bevel. This
         // triangle is literal for miters and is conic control points for round joins.
-        SkASSERT(miterCapHeightOverWidth >= 0);
+        SkASSERT(miterCapHeightOverWidth >= 0 || SkScalarIsNaN(miterCapHeightOverWidth));
         Sk2f base = n1 - n0;
         Sk2f baseNorm = Sk2f(base[1], -base[0]);
         Sk2f c = (n0 + n1) * .5f + baseNorm * miterCapHeightOverWidth;