Don't do PolyUtil fuzz tests on invalid polygons.

We shouldn't be trying to run the convex routine on known non-convex
polygons, and the offset routine only works for simple polygons.

Bug: oss-fuzz:43588
Change-Id: Ia1c73d05d7b1496c9d0599ee36eafe1d58684fd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494818
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/fuzz/FuzzPolyUtils.cpp b/fuzz/FuzzPolyUtils.cpp
index 859de15..ef7941d 100644
--- a/fuzz/FuzzPolyUtils.cpp
+++ b/fuzz/FuzzPolyUtils.cpp
@@ -32,22 +32,26 @@
     bounds.setBoundsCheck(polygon, count);
 
     ignoreResult(SkGetPolygonWinding(polygon, count));
-    ignoreResult(SkIsConvexPolygon(polygon, count));
-    ignoreResult(SkIsSimplePolygon(polygon, count));
+    bool isConvex = SkIsConvexPolygon(polygon, count);
+    bool isSimple = SkIsSimplePolygon(polygon, count);
 
-    SkScalar inset;
-    fuzz->next(&inset);
     SkTDArray<SkPoint> output;
-    ignoreResult(SkInsetConvexPolygon(polygon, count, inset, &output));
-
-    SkScalar offset;
-    fuzz->next(&offset);
-    ignoreResult(SkOffsetSimplePolygon(polygon, count, bounds, offset, &output));
-
-    SkAutoSTMalloc<64, uint16_t> indexMap(count);
-    for (int index = 0; index < count; ++index) {
-        fuzz->next(&indexMap[index]);
+    if (isConvex) {
+        SkScalar inset;
+        fuzz->next(&inset);
+        ignoreResult(SkInsetConvexPolygon(polygon, count, inset, &output));
     }
-    SkTDArray<uint16_t> outputIndices;
-    ignoreResult(SkTriangulateSimplePolygon(polygon, indexMap, count, &outputIndices));
+
+    if (isSimple) {
+        SkScalar offset;
+        fuzz->next(&offset);
+        ignoreResult(SkOffsetSimplePolygon(polygon, count, bounds, offset, &output));
+
+        SkAutoSTMalloc<64, uint16_t> indexMap(count);
+        for (int index = 0; index < count; ++index) {
+            fuzz->next(&indexMap[index]);
+        }
+        SkTDArray<uint16_t> outputIndices;
+        ignoreResult(SkTriangulateSimplePolygon(polygon, indexMap, count, &outputIndices));
+    }
 }