check for finite vertices

Bug: oss-fuzz:6115
Change-Id: Ib971304141322cfcf62ed079ef10c2910a9e2bf1
Reviewed-on: https://skia-review.googlesource.com/125343
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp
index 8c1ad1f..000be07 100644
--- a/src/core/SkDraw_vertices.cpp
+++ b/src/core/SkDraw_vertices.cpp
@@ -223,6 +223,15 @@
     SkPoint* devVerts = outerAlloc.makeArray<SkPoint>(count);
     fMatrix->mapPoints(devVerts, vertices, count);
 
+    {
+        SkRect bounds;
+        // this also sets bounds to empty if we see a non-finite value
+        bounds.set(devVerts, count);
+        if (bounds.isEmpty()) {
+            return;
+        }
+    }
+
     VertState       state(count, indices, indexCount);
     VertState::Proc vertProc = state.chooseProc(vmode);