aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpSpan.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-07-19 11:29:14 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-19 11:29:15 -0700
commit1493b9772d6fad455a222ec6f242903128e049a0 (patch)
tree5c245854f2de4b21f501bd9072f54a1c6893852b /src/pathops/SkOpSpan.cpp
parentff1740394e23ba23c8e78e3c06f7940103fa3c8b (diff)
fix fuzzer
Previous spans always have a valid next pointer. The final span does not. Change the test for a valid link to take into consideration whether the links are chased forwards or backwards. TBR=reed@google.com BUG=629454 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2166543002 Review-Url: https://codereview.chromium.org/2166543002
Diffstat (limited to 'src/pathops/SkOpSpan.cpp')
-rwxr-xr-xsrc/pathops/SkOpSpan.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp
index 577a9db326..1cdfe91a24 100755
--- a/src/pathops/SkOpSpan.cpp
+++ b/src/pathops/SkOpSpan.cpp
@@ -387,9 +387,18 @@ bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped) {
SkOpPtT* next = &fPtT;
while ((next = next->next()) != &fPtT) {
if (next->segment() == segment) {
- SkOpSpan* span = flipped ? next->span()->prev() : next->span()->upCast();
- if (!span) {
- return false;
+ SkOpSpan* span;
+ if (flipped) {
+ span = next->span()->prev();
+ if (!span) {
+ return false;
+ }
+ } else {
+ SkOpSpanBase* base = next->span();
+ if (!base->upCastable()) {
+ return false;
+ }
+ span = base->upCast();
}
this->insertCoincidence(span);
return true;