diff options
author | Cary Clark <caryclark@skia.org> | 2017-03-08 17:11:12 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-09 14:11:11 +0000 |
commit | 4eed4c885050132b7131324ea336ad0f6d977fef (patch) | |
tree | 436f9a98b16321b010a3dd32c0e19780ea32822b /src/pathops | |
parent | 08541e8d7f28d875f5a6238aea1bae871e4aa276 (diff) |
limit addEndMoveSpans loop in pathops
Prevent addEndMoveSpans from looping
forever and abort with an error
if the loop count is crazy big.
R=kjlubick@google.com
BUG=684553
Change-Id: I16c250c0b2f88534f809aba17a18081aea4e1f44
Reviewed-on: https://skia-review.googlesource.com/9458
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/pathops')
-rw-r--r-- | src/pathops/SkOpCoincidence.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp index b4854a801a..93a6d66fad 100644 --- a/src/pathops/SkOpCoincidence.cpp +++ b/src/pathops/SkOpCoincidence.cpp @@ -278,7 +278,11 @@ bool SkOpCoincidence::addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* const SkOpPtT* testPtT = testSpan->ptT(); const SkOpPtT* stopPtT = testPtT; const SkOpSegment* baseSeg = base->segment(); + int escapeHatch = 100000; // this is 100 times larger than the debugLoopLimit test while ((testPtT = testPtT->next()) != stopPtT) { + if (--escapeHatch <= 0) { + return false; // if triggered (likely by a fuzz-generated test) too complex to succeed + } const SkOpSegment* testSeg = testPtT->segment(); if (testPtT->deleted()) { continue; |