aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-05-18 16:29:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-18 21:03:54 +0000
commitba5b5f5171680701d27c68f13e378eb5d539ae07 (patch)
tree313f7be6f62546805636391584aef8984626d0c6 /include/effects
parent5699278b679f27e1426ff1867807d689f0e806d4 (diff)
harden line2d effect
Suggested by https://fuzzer.skia.org/category/n32_canvas/file/c3JjL2NvcmUvU2tTdHJva2UuY3Bw? Bug: skia: Change-Id: I8ec48f844bfa5d063f0ab1bdfe0612ec4673ada3 Reviewed-on: https://skia-review.googlesource.com/129260 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/effects')
-rw-r--r--include/effects/Sk2DPathEffect.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h
index 5b7df35df2..5ebadab0d5 100644
--- a/include/effects/Sk2DPathEffect.h
+++ b/include/effects/Sk2DPathEffect.h
@@ -56,6 +56,9 @@ private:
class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
public:
static sk_sp<SkPathEffect> Make(SkScalar width, const SkMatrix& matrix) {
+ if (!(width >= 0)) {
+ return nullptr;
+ }
return sk_sp<SkPathEffect>(new SkLine2DPathEffect(width, matrix));
}
@@ -67,7 +70,9 @@ public:
protected:
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
- : Sk2DPathEffect(matrix), fWidth(width) {}
+ : Sk2DPathEffect(matrix), fWidth(width) {
+ SkASSERT(width >= 0);
+ }
void flatten(SkWriteBuffer&) const override;
void nextSpan(int u, int v, int ucount, SkPath*) const override;