From aa7ceb62b51bfe1057c83b3475797ec7c82bc964 Mon Sep 17 00:00:00 2001 From: caryclark Date: Wed, 29 Jun 2016 10:46:08 -0700 Subject: fix another pathops fuzz bug Tunnel out the error case when the numerics create uncalculable angles. R=mmoroz@chromium.org TBR=reed@google.com BUG=624351 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103863005 Review-Url: https://codereview.chromium.org/2103863005 --- src/pathops/SkPathOpsCommon.cpp | 3 +++ src/pathops/SkPathOpsOp.cpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp index ec8e78d0cb..24ef6f1129 100644 --- a/src/pathops/SkPathOpsCommon.cpp +++ b/src/pathops/SkPathOpsCommon.cpp @@ -27,6 +27,9 @@ const SkOpAngle* AngleWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* windi int winding = SK_MinS32; do { angle = angle->next(); + if (!angle) { + return nullptr; + } unorderable |= angle->unorderable(); if ((computeWinding = unorderable || (angle == firstAngle && loop))) { break; // if we get here, there's no winding, loop is unorderable diff --git a/src/pathops/SkPathOpsOp.cpp b/src/pathops/SkPathOpsOp.cpp index 25795047c8..1970eea124 100644 --- a/src/pathops/SkPathOpsOp.cpp +++ b/src/pathops/SkPathOpsOp.cpp @@ -36,6 +36,9 @@ static SkOpSegment* findChaseOp(SkTDArray& chase, SkOpSpanBase** int winding; bool sortable; const SkOpAngle* angle = AngleWinding(*startPtr, *endPtr, &winding, &sortable); + if (!angle) { + return nullptr; + } if (winding == SK_MinS32) { continue; } -- cgit v1.2.3