aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-06-29 08:18:38 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-29 08:18:38 -0700
commit343382e3acc8369f7bd4328e7c807255b5776fe5 (patch)
tree96c9c57607142aa248a2c008086c80f840521641 /src/pathops
parent2633e62f7798a17f095ba1f27ec1f72e5472c439 (diff)
fix fuzz test that exceeds numeric limit
The extreme values here exceed an internal test that expects computed numbers to be less than MAX_FLT. Use MAX_DBL instead. R=mmoroz@chromium.org TBR=reed@google.com BUG=624346 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103903004 Review-Url: https://codereview.chromium.org/2103903004
Diffstat (limited to 'src/pathops')
-rw-r--r--src/pathops/SkOpSegment.cpp7
-rw-r--r--src/pathops/SkPathOpsTSect.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 24f76aa6de..41d62369b6 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -1130,7 +1130,9 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS
SkOpPtT* otherPtT = endSpan->ptT()->next();
other = otherPtT->segment();
foundSpan = otherPtT->span();
- otherEnd = step > 0 ? foundSpan->upCast()->next() : foundSpan->prev();
+ otherEnd = step > 0
+ ? foundSpan->upCastable() ? foundSpan->upCast()->next() : nullptr
+ : foundSpan->prev();
} else {
int loopCount = angle->loopCount();
if (loopCount > 2) {
@@ -1150,6 +1152,9 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS
foundSpan = endSpan = next->start();
otherEnd = next->end();
}
+ if (!otherEnd) {
+ return nullptr;
+ }
int foundStep = foundSpan->step(otherEnd);
if (*stepPtr != foundStep) {
return set_last(last, endSpan);
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h
index cf63b334d5..48aa540945 100644
--- a/src/pathops/SkPathOpsTSect.h
+++ b/src/pathops/SkPathOpsTSect.h
@@ -427,7 +427,7 @@ void SkTSect<TCurve, OppCurve>::addForPerp(SkTSpan<OppCurve, TCurve>* span, doub
template<typename TCurve, typename OppCurve>
double SkTSpan<TCurve, OppCurve>::closestBoundedT(const SkDPoint& pt) const {
double result = -1;
- double closest = FLT_MAX;
+ double closest = DBL_MAX;
const SkTSpanBounded<OppCurve, TCurve>* testBounded = fBounded;
while (testBounded) {
const SkTSpan<OppCurve, TCurve>* test = testBounded->fBounded;