diff options
author | 2016-02-20 14:18:27 -0800 | |
---|---|---|
committer | 2016-02-20 14:18:27 -0800 | |
commit | 00bea4ad310c4ec4dd95809b47ce3fbfa8fd0e1e (patch) | |
tree | 8c7e11efbc4c108252a219c763010d5035b10846 /src/effects/SkDashPathEffect.cpp | |
parent | f5d4746ad73ef5eabc927d3d988bb9ee97c77921 (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=robertphilips
Review URL: https://codereview.chromium.org/1713383002
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); +} |