diff options
author | reed <reed@google.com> | 2016-02-20 14:18:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-20 14:18:27 -0800 |
commit | 00bea4ad310c4ec4dd95809b47ce3fbfa8fd0e1e (patch) | |
tree | 8c7e11efbc4c108252a219c763010d5035b10846 /include/core/SkPathEffect.h | |
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 'include/core/SkPathEffect.h')
-rw-r--r-- | include/core/SkPathEffect.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h index bd68c8fa72..a77b9467e4 100644 --- a/include/core/SkPathEffect.h +++ b/include/core/SkPathEffect.h @@ -183,7 +183,13 @@ public: The reference counts for outer and inner are both incremented in the constructor, and decremented in the destructor. */ - static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) { + static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) { + if (!outer) { + return SkSafeRef(inner); + } + if (!inner) { + return SkSafeRef(outer); + } return new SkComposePathEffect(outer, inner); } @@ -220,7 +226,13 @@ public: The reference counts for first and second are both incremented in the constructor, and decremented in the destructor. */ - static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { + static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { + if (!first) { + return SkSafeRef(second); + } + if (!second) { + return SkSafeRef(first); + } return new SkSumPathEffect(first, second); } |