diff options
author | caryclark <caryclark@google.com> | 2016-10-20 08:32:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-20 08:32:18 -0700 |
commit | a35ab3e6e024d0b548ded26a2e3b8ecd838ead93 (patch) | |
tree | c009069f86b1129fcf5037ffc8e8fbf1b9ba010f /src/pathops/SkPathWriter.cpp | |
parent | 65820db5e15201a3f30968420232d36c0ca89cd8 (diff) |
fix fuzzers
Many old pathops-related fuzz failures have built up while
the codebase was under a state a flux. Now that the code
is stable, address these failures.
Most of the CL plumbs the debug global state to downstream
routines so that, if the data is not trusted (ala fuzzed)
the function can safely exit without asserting.
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426173002
Review-Url: https://chromiumcodereview.appspot.com/2426173002
Diffstat (limited to 'src/pathops/SkPathWriter.cpp')
-rw-r--r-- | src/pathops/SkPathWriter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pathops/SkPathWriter.cpp b/src/pathops/SkPathWriter.cpp index 1f6dddd137..c94809e8ec 100644 --- a/src/pathops/SkPathWriter.cpp +++ b/src/pathops/SkPathWriter.cpp @@ -48,23 +48,26 @@ void SkPathWriter::cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkOpPtT fCurrent.cubicTo(pt1, pt2, pt3->fPt); } -void SkPathWriter::deferredLine(const SkOpPtT* pt) { +bool SkPathWriter::deferredLine(const SkOpPtT* pt) { SkASSERT(fFirstPtT); SkASSERT(fDefer[0]); if (fDefer[0] == pt) { // FIXME: why we're adding a degenerate line? Caller should have preflighted this. - return; + return true; } if (pt->contains(fDefer[0])) { // FIXME: why we're adding a degenerate line? - return; + return true; + } + if (this->matchedLast(pt)) { + return false; } - SkASSERT(!this->matchedLast(pt)); if (fDefer[1] && this->changedSlopes(pt)) { this->lineTo(); fDefer[0] = fDefer[1]; } fDefer[1] = pt; + return true; } void SkPathWriter::deferredMove(const SkOpPtT* pt) { |