fix pathops fuzz
add escape hatch to abort infinite loop
when fed fuzzed data
R=kjlubick@google.com
Docs-Preview: https://skia.org/?cl=172745
Bug: 907844
Change-Id: I015fa1f6f8b697ad438e3d17c4254b65511d699e
Reviewed-on: https://skia-review.googlesource.com/c/172745
Commit-Queue: Cary Clark <caryclark@skia.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 7953c25..ff21828 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -1273,7 +1273,11 @@
}
SkOpPtT* startPtT = test->ptT();
SkOpPtT* testPtT = startPtT;
+ int safetyHatch = 1000000;
do { // iterate through all spans associated with start
+ if (!--safetyHatch) {
+ return false;
+ }
SkOpSpanBase* oppSpan = testPtT->span();
if (oppSpan->spanAddsCount() == addCount) {
continue;