aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@google.com>2017-07-05 10:38:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-06 12:35:14 +0000
commitae68a399cdf3d94aff28e497d5360bc288f2131d (patch)
treeb6108249d8ba46de080e7f7b6816dab3e166e6bd
parent3223e276c994c08ecc72d6925851f17e2d9c4732 (diff)
protect against fuzzer
Fuzzer data may generate path without a computable length. R=reed@google.com Bug: 739190 Change-Id: I052540932937f24951ce66699080b8b959fb1a46 Reviewed-on: https://skia-review.googlesource.com/21500 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
-rw-r--r--src/core/SkPathMeasure.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index 626deebd72..34b164827c 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -513,6 +513,9 @@ SkScalar SkPathMeasure::getLength() {
if (fLength < 0) {
this->buildSegments();
}
+ if (SkScalarIsNaN(fLength)) {
+ fLength = 0;
+ }
SkASSERT(fLength >= 0);
return fLength;
}