aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-06-25 10:06:03 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-25 14:41:25 +0000
commit86d87d2e69c31af9c1ff8e60ca1a1e10f0b3264c (patch)
tree108397cf79eab54ee57aa4894208a132af5d5571
parent0ea256c4db3fa8a86839041b17aef59775b3b314 (diff)
fix path measure fuzzes
these fixes suppress debug asserts when the fuzzer is run R=reed@google.com,kjlubick@google.com Bug: skia: Change-Id: I7b8c16fe475056213314ecb588a4368b547836b0 Reviewed-on: https://skia-review.googlesource.com/137363 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
-rw-r--r--src/core/SkPathMeasure.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index e69ea49521..75e2bdf170 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -265,7 +265,7 @@ SkScalar SkPathMeasure::compute_conic_segs(const SkConic& conic, SkScalar distan
int halft = (mint + maxt) >> 1;
SkPoint halfPt = conic.evalAt(tValue2Scalar(halft));
if (!halfPt.isFinite()) {
- return 0;
+ return distance;
}
if (tspan_big_enough(maxt - mint) && conic_too_curvy(minPt, halfPt, maxPt)) {
distance = this->compute_conic_segs(conic, distance, mint, minPt, halft, halfPt, ptIndex);
@@ -620,6 +620,9 @@ bool SkPathMeasure::getPosTan(SkScalar distance, SkPoint* pos, SkVector* tangent
SkScalar t;
const Segment* seg = this->distanceToSegment(distance, &t);
+ if (SkScalarIsNaN(t)) {
+ return false;
+ }
compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, t, pos, tangent);
return true;