fix fuzz
authorcaryclark <caryclark@google.com>
Tue, 25 Oct 2016 15:58:26 +0000 (08:58 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 25 Oct 2016 15:58:26 +0000 (08:58 -0700)
Abort early if fuzz data
breaks intersection.

R=kjlubick@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2444333002

Review-Url: https://codereview.chromium.org/2444333002

BUILD.gn
src/pathops/SkPathOpsTSect.h
tests/skia_test.cpp

index 1967016..00f70d9 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1134,6 +1134,31 @@ if (skia_enable_tools) {
     testonly = true
   }
 
+  pathops_tests_sources = exec_script("gyp/find.py",
+                                      [
+                                        "PathOps*.cpp",
+                                        rebase_path("tests"),
+                                      ],
+                                      "list lines",
+                                      [])
+
+  executable("pathops_unittest") {
+    sources =
+        pathops_tests_sources -
+        [ rebase_path("tests/PathOpsSkpClipTest.cpp") ] +  # alternate main
+        [
+          rebase_path("tests/skia_test.cpp"),
+          rebase_path("tests/Test.cpp"),
+        ]
+    deps = [
+      ":flags",
+      ":gpu_tool_utils",
+      ":skia",
+      ":tool_utils",
+    ]
+    testonly = true
+  }
+
   executable("dump_record") {
     sources = [
       "tools/DumpRecord.cpp",
index fbfb8c1..f3402da 100644 (file)
@@ -992,6 +992,9 @@ SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::boundsMax() const {
 template<typename TCurve, typename OppCurve>
 bool SkTSect<TCurve, OppCurve>::coincidentCheck(SkTSect<OppCurve, TCurve>* sect2) {
     SkTSpan<TCurve, OppCurve>* first = fHead;
+    if (!first) {
+        return false;
+    }
     SkTSpan<TCurve, OppCurve>* last, * next;
     do {
         int consecutive = this->countConsecutiveSpans(first, &last);
index 462735a..93b6c69 100644 (file)
@@ -171,7 +171,7 @@ int test_main() {
         if (FLAGS_dumpOp) {
             header.appendf(" -d");
         }
-#if SK_DEBUG
+#ifdef SK_DEBUG
         if (FLAGS_runFail) {
             header.appendf(" -f");
         }