aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkPathOpsCommon.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-06-28 09:23:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-28 09:23:57 -0700
commit3f0753d3eccece8ac7f02f6af36d66a96c3dfb26 (patch)
treea7dca73764a07182471f1c69de159d92059ee9bf /src/pathops/SkPathOpsCommon.cpp
parent74139f1b49d02b38006170c3e50439c1b33b175f (diff)
fix fuzz bugs
Detect more places where the pathops numerics cause numbers to become nearly identical and subsequently fail. These tests have extreme inputs and cannot succeed. Also remove the expectSuccess parameter from PathOpsDebug and check instead in the test framework. R=mbarbella@chromium.org TBR=reed@google.com BUG=623072,623022 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103513002 Review-Url: https://codereview.chromium.org/2103513002
Diffstat (limited to 'src/pathops/SkPathOpsCommon.cpp')
-rw-r--r--src/pathops/SkPathOpsCommon.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp
index 340b306d60..ec8e78d0cb 100644
--- a/src/pathops/SkPathOpsCommon.cpp
+++ b/src/pathops/SkPathOpsCommon.cpp
@@ -466,7 +466,9 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby");
align(contourList); // give all span members common values
DEBUG_COINCIDENCE_HEALTH(contourList, "align");
- coincidence->fixAligned(); // aligning may have marked a coincidence pt-t deleted
+ if (!coincidence->fixAligned()) { // aligning may have marked a coincidence pt-t deleted
+ return false;
+ }
DEBUG_COINCIDENCE_HEALTH(contourList, "fixAligned");
#if DEBUG_VALIDATE
globalState->setPhase(SkOpGlobalState::kIntersecting);
@@ -480,7 +482,9 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby2");
align(contourList); // give all span members common values
DEBUG_COINCIDENCE_HEALTH(contourList, "align2");
- coincidence->fixAligned(); // aligning may have marked a coincidence pt-t deleted
+ if (!coincidence->fixAligned()) { // aligning may have marked a coincidence pt-t deleted
+ return false;
+ }
DEBUG_COINCIDENCE_HEALTH(contourList, "fixAligned2");
}
#if DEBUG_VALIDATE
@@ -520,7 +524,9 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
DEBUG_COINCIDENCE_HEALTH(contourList, "pairs->apply");
// For each coincident pair that overlaps another, when the receivers (the 1st of the pair)
// are different, construct a new pair to resolve their mutual span
- pairs->findOverlaps(&overlaps, allocator);
+ if (!pairs->findOverlaps(&overlaps, allocator)) {
+ return false;
+ }
DEBUG_COINCIDENCE_HEALTH(contourList, "pairs->findOverlaps");
} while (!overlaps.isEmpty());
calcAngles(contourList, allocator);