diff options
author | Cary Clark <caryclark@skia.org> | 2017-03-21 10:30:50 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-21 15:18:11 +0000 |
commit | 28da2837040cd116dd2d854dd3268723ca219f11 (patch) | |
tree | 9964e5452b2af80dfe6bf6275a6283395f798d5f /src/pathops/SkPathOpsCommon.cpp | |
parent | 90960eb1face12f7855c98db0e4af11c03377829 (diff) |
fix fuzz
corrupted intersection point lists
can loop forever. Add a safety
hatch to abort after a large number
of iterations.
TBR=kjlubick@google.com
BUG=700679
Change-Id: Ifd4b180b47ba3bbde38ade0bb13b16b8d645c1cb
Reviewed-on: https://skia-review.googlesource.com/9967
Reviewed-by: Cary Clark <caryclark@skia.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
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 59bab0f6bd..9cdf8124a8 100644 --- a/src/pathops/SkPathOpsCommon.cpp +++ b/src/pathops/SkPathOpsCommon.cpp @@ -228,12 +228,15 @@ static bool move_multiples(SkOpContourHead* contourList DEBUG_COIN_DECLARE_PARA return true; } -static void move_nearby(SkOpContourHead* contourList DEBUG_COIN_DECLARE_PARAMS()) { +static bool move_nearby(SkOpContourHead* contourList DEBUG_COIN_DECLARE_PARAMS()) { DEBUG_STATIC_SET_PHASE(contourList); SkOpContour* contour = contourList; do { - contour->moveNearby(); + if (!contour->moveNearby()) { + return false; + } } while ((contour = contour->next())); + return true; } static bool sort_angles(SkOpContourHead* contourList) { @@ -257,7 +260,9 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc return false; } // move t values and points together to eliminate small/tiny gaps - move_nearby(contourList DEBUG_COIN_PARAMS()); + if (!move_nearby(contourList DEBUG_COIN_PARAMS())) { + return false; + } // add coincidence formed by pairing on curve points and endpoints coincidence->correctEnds(DEBUG_PHASE_ONLY_PARAMS(kIntersecting)); if (!coincidence->addEndMovedSpans(DEBUG_COIN_ONLY_PARAMS())) { |