fix pathops timeouts
R=kjlubick@google.com
Bug: skia:8475
Change-Id: I88a440d55872e8f655236b86e30a95bff1fef695
Reviewed-on: https://skia-review.googlesource.com/c/163128
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index e35f6d0..89a39b4 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -921,7 +921,11 @@
bool success = markWinding(spanStart, winding, oppWinding);
SkOpSpanBase* last = nullptr;
SkOpSegment* other = this;
+ int safetyNet = 100000;
while ((other = other->nextChase(&start, &step, &spanStart, &last))) {
+ if (!--safetyNet) {
+ return false;
+ }
if (spanStart->windSum() != SK_MinS32) {
if (this->operand() == other->operand()) {
if (spanStart->windSum() != winding || spanStart->oppSum() != oppWinding) {