aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpCoincidence.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-08-08 14:27:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-08 14:27:45 -0700
commit643ede69216c073c2dd497c382577dc9fde36b3e (patch)
tree209b86d3896077fd35085c15a343a2abe45a1574 /src/pathops/SkOpCoincidence.cpp
parent61f36b37084e7b1c80cfc485825588604a401c9a (diff)
template intersection fuzz fixes
Plumb in the ability to ignore asserts for out of range input deeper into the template intersection code. Exit gracefully when error conditions are found. TBR=reed@google.com BUG=632607,632628,633063,633065,634251,633608 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2224823004 Review-Url: https://codereview.chromium.org/2224823004
Diffstat (limited to 'src/pathops/SkOpCoincidence.cpp')
-rwxr-xr-xsrc/pathops/SkOpCoincidence.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index a9c3204003..bb26b1370f 100755
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -461,6 +461,9 @@ bool SkOpCoincidence::addExpanded() {
}
}
if (test != end) {
+ if (!test->upCastable()) {
+ return false;
+ }
test = test->upCast()->next();
}
if (oTest != oEnd) {
@@ -606,7 +609,9 @@ bool SkOpCoincidence::addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over1e,
bool SkOpCoincidence::addOrOverlap(SkOpSegment* coinSeg, SkOpSegment* oppSeg,
double coinTs, double coinTe, double oppTs, double oppTe) {
SkTDArray<SkCoincidentSpans*> overlaps;
- SkASSERT(fTop);
+ if (!fTop) {
+ return false;
+ }
if (!this->checkOverlap(fTop, coinSeg, oppSeg, coinTs, coinTe, oppTs, oppTe, &overlaps)) {
return false;
}
@@ -683,6 +688,9 @@ bool SkOpCoincidence::addOrOverlap(SkOpSegment* coinSeg, SkOpSegment* oppSeg,
: coinSeg->addT(coinTs, SkOpSegment::kNoAliasMatch, nullptr);
SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os)
: oppSeg->addT(oppTs, SkOpSegment::kNoAliasMatch, nullptr);
+ if (!osWritable) {
+ return false;
+ }
csWritable->span()->addOppAndMerge(osWritable->span());
cs = csWritable;
os = osWritable;
@@ -1379,6 +1387,9 @@ bool SkOpCoincidence::mark() {
}
}
while ((oNext = oNext->upCast()->next()) != oEnd) {
+ if (!oNext->upCastable()) {
+ return false;
+ }
if (!oNext->upCast()->insertCoincidence(segment, flipped)) {
return false;
}