diff options
author | reed <reed@google.com> | 2016-02-22 06:34:47 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-22 06:34:47 -0800 |
commit | 653db51b440491b0fb1908bf5a43dcc89c90044d (patch) | |
tree | aeb0b70eca04c99db9018c28e5108246d3ddfe4a /src/effects/SkDashPathEffect.cpp | |
parent | 1d56448400c1da722a9b34c80ff4a9e46dc3c173 (diff) |
fix misc asserts and checks found by fuzzer
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1713383002
TBR=
Review URL: https://codereview.chromium.org/1719913002
Diffstat (limited to 'src/effects/SkDashPathEffect.cpp')
-rw-r--r-- | src/effects/SkDashPathEffect.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp index 6e10e5466d..ced0aab69a 100644 --- a/src/effects/SkDashPathEffect.cpp +++ b/src/effects/SkDashPathEffect.cpp @@ -384,3 +384,17 @@ void SkDashPathEffect::toString(SkString* str) const { str->appendf("))"); } #endif + +////////////////////////////////////////////////////////////////////////////////////////////////// + +SkPathEffect* SkDashPathEffect::Create(const SkScalar intervals[], int count, SkScalar phase) { + if ((count < 2) || !SkIsAlign2(count)) { + return nullptr; + } + for (int i = 0; i < count; i++) { + if (intervals[i] < 0) { + return nullptr; + } + } + return new SkDashPathEffect(intervals, count, phase); +} |