diff options
author | caryclark <caryclark@google.com> | 2016-02-24 09:03:07 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-24 09:03:07 -0800 |
commit | d78c088b6136590371fddd4cab67bfb4bf692fd3 (patch) | |
tree | 7b928823d239ea0c5089b9696af635f694873188 /src/pathops/SkPathOpsCommon.cpp | |
parent | d9381acb0efc84e5b54627de554c6cefc43ca97d (diff) |
fix path ops fuzz bug
If one path is empty and the other has extreme values, the
intermediate coincident paths cannot be resolved, but triggers
an assert that a data structure unexpectedly has zero-length.
Tunnel this failure back up to the top and return that the
entire path op fails.
A future optimization could detect the empty path and avoid
this, allowing the op to succeed -- not sure that it's worth
the additional logic though.
TBR=reed@google.com
BUG=535151
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1730293002
Review URL: https://codereview.chromium.org/1730293002
Diffstat (limited to 'src/pathops/SkPathOpsCommon.cpp')
-rw-r--r-- | src/pathops/SkPathOpsCommon.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp index 0060db2f30..829f8a50d5 100644 --- a/src/pathops/SkPathOpsCommon.cpp +++ b/src/pathops/SkPathOpsCommon.cpp @@ -425,11 +425,14 @@ static bool missingCoincidence(SkOpContourHead* contourList, return result; } -static void moveMultiples(SkOpContourHead* contourList) { +static bool moveMultiples(SkOpContourHead* contourList) { SkOpContour* contour = contourList; do { - contour->moveMultiples(); + if (!contour->moveMultiples()) { + return false; + } } while ((contour = contour->next())); + return true; } static void moveNearby(SkOpContourHead* contourList) { @@ -451,7 +454,9 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc SkOpGlobalState* globalState = contourList->globalState(); // combine t values when multiple intersections occur on some segments but not others DEBUG_COINCIDENCE_HEALTH(contourList, "start"); - moveMultiples(contourList); + if (!moveMultiples(contourList)) { + return false; + } DEBUG_COINCIDENCE_HEALTH(contourList, "moveMultiples"); findCollapsed(contourList); DEBUG_COINCIDENCE_HEALTH(contourList, "findCollapsed"); |