diff options
author | caryclark <caryclark@google.com> | 2016-09-07 08:21:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-07 08:21:09 -0700 |
commit | b393a49e5fa7e69ba67692929e9fa2a4e1f6bbb1 (patch) | |
tree | 5655f33260f8b6373555e315cab961aee5b06e3a /src/pathops | |
parent | 77320dbabcddf05c0a1489eaf1f496729dc8de0e (diff) |
fix pathops fuzzers
Extreme values trigger asserts that in range
values allow.
Disable asserts and other tests to prevent
extreme values from crashing.
TBR=reed@google.com
BUG=644684. 644680, 644640
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2316173002
Review-Url: https://codereview.chromium.org/2316173002
Diffstat (limited to 'src/pathops')
-rwxr-xr-x | src/pathops/SkOpCoincidence.cpp | 21 | ||||
-rwxr-xr-x | src/pathops/SkOpSpan.cpp | 4 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp index 61ea3ef444..0548ed5a05 100755 --- a/src/pathops/SkOpCoincidence.cpp +++ b/src/pathops/SkOpCoincidence.cpp @@ -551,6 +551,9 @@ double SkOpCoincidence::TRange(const SkOpPtT* overS, double t, do { const SkOpPtT* contained = work->contains(coinSeg); if (!contained) { + if (work->t() >= t) { + return 1; + } continue; } if (work->t() <= t) { @@ -795,7 +798,9 @@ bool SkOpCoincidence::addMissing() { const SkOpSegment* outerCoin = ocs->segment(); SkASSERT(!outerCoin->done()); // if it's done, should have already been removed from list const SkOpPtT* oos = outer->oppPtTStart(); - SkASSERT(!oos->deleted()); + if (oos->deleted()) { + return false; + } const SkOpSegment* outerOpp = oos->segment(); SkASSERT(!outerOpp->done()); SkOpSegment* outerCoinWritable = const_cast<SkOpSegment*>(outerCoin); @@ -816,7 +821,9 @@ bool SkOpCoincidence::addMissing() { SkOpSegment* innerOppWritable = const_cast<SkOpSegment*>(innerOpp); if (outerCoin == innerCoin) { const SkOpPtT* oce = outer->coinPtTEnd(); - SkASSERT(!oce->deleted()); + if (oce->deleted()) { + return false; + } const SkOpPtT* ice = inner->coinPtTEnd(); SkASSERT(!ice->deleted()); if (outerOpp != innerOpp && this->overlap(ocs, oce, ics, ice, &overS, &overE)) { @@ -852,7 +859,9 @@ bool SkOpCoincidence::addMissing() { const SkOpPtT* ooe = outer->oppPtTEnd(); SkASSERT(!ooe->deleted()); const SkOpPtT* ioe = inner->oppPtTEnd(); - SkASSERT(!ioe->deleted()); + if (ioe->deleted()) { + return false; + } SkASSERT(outerCoin != innerCoin); if (this->overlap(oos, ooe, ios, ioe, &overS, &overE)) { added |= this->addIfMissing(oos->starter(ooe), ios->starter(ioe), @@ -1394,7 +1403,7 @@ bool SkOpCoincidence::removeCollapsed() { } void SkOpCoincidence::fixUp(SkOpPtT* deleted, const SkOpPtT* kept) { - SkASSERT(deleted != kept); + SkOPASSERT(deleted != kept); if (fHead) { this->fixUp(fHead, deleted, kept); } @@ -1453,7 +1462,9 @@ bool SkOpCoincidence::mark() { SkOpSpanBase* end = coin->coinPtTEndWritable()->span(); SkASSERT(!end->deleted()); SkOpSpanBase* oStart = coin->oppPtTStartWritable()->span(); - SkASSERT(!oStart->deleted()); + if (oStart->deleted()) { + return false; + } SkOpSpanBase* oEnd = coin->oppPtTEndWritable()->span(); SkASSERT(!oEnd->deleted()); bool flipped = coin->flipped(); diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp index 162bcad293..70b47b6e9b 100755 --- a/src/pathops/SkOpSpan.cpp +++ b/src/pathops/SkOpSpan.cpp @@ -394,7 +394,7 @@ void SkOpSpanBase::mergeMatches(SkOpSpanBase* opp) { if (!zero_or_one(inner->fT)) { innerBase->upCast()->release(test); } else { - SkASSERT(inner->fT != test->fT); + SkOPASSERT(inner->fT != test->fT); if (!zero_or_one(test->fT)) { testBase->upCast()->release(inner); } else { @@ -491,7 +491,7 @@ bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped) { void SkOpSpan::release(const SkOpPtT* kept) { SkDEBUGCODE(fDebugDeleted = true); - SkASSERT(kept->span() != this); + SkOPASSERT(kept->span() != this); SkASSERT(!final()); SkOpSpan* prev = this->prev(); SkASSERT(prev); |