diff options
author | Kevin Lubick <kjlubick@google.com> | 2017-01-06 13:48:19 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-06 19:58:27 +0000 |
commit | f04c50ab9491b28aceb9d43acbf02b4f5d577ba7 (patch) | |
tree | ed81247a85de9ee01688425d6070d833acc24550 /fuzz/fuzz.cpp | |
parent | bfd2db8bfdd2206964a5c74f1643cdd40cea8f14 (diff) |
Add in Path fuzzer
BUG=skia:
Change-Id: Ic8a56448b39bf6a8c6388bffb7f3b7c5ed798a2f
Reviewed-on: https://skia-review.googlesource.com/6692
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'fuzz/fuzz.cpp')
-rw-r--r-- | fuzz/fuzz.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp index 43c2b39ab5..1543c43428 100644 --- a/fuzz/fuzz.cpp +++ b/fuzz/fuzz.cpp @@ -13,6 +13,7 @@ #include "SkImage.h" #include "SkImageEncoder.h" #include "SkMallocPixelRef.h" +#include "SkPath.h" #include "SkOSFile.h" #include "SkOSPath.h" #include "SkPicture.h" @@ -43,6 +44,7 @@ static void fuzz_img(sk_sp<SkData>, uint8_t, uint8_t); static void fuzz_skp(sk_sp<SkData>); static void fuzz_icc(sk_sp<SkData>); static void fuzz_color_deserialize(sk_sp<SkData>); +static void fuzz_path_deserialize(sk_sp<SkData>); #if SK_SUPPORT_GPU static void fuzz_sksl2glsl(sk_sp<SkData>); #endif @@ -98,6 +100,10 @@ static int fuzz_file(const char* path) { fuzz_img(bytes, 0, option); return 0; } + if (0 == strcmp("path_deserialize", FLAGS_type[0])) { + fuzz_path_deserialize(bytes); + return 0; + } if (0 == strcmp("skp", FLAGS_type[0])) { fuzz_skp(bytes); return 0; @@ -461,6 +467,15 @@ static void fuzz_color_deserialize(sk_sp<SkData> bytes) { SkDebugf("[terminated] Success! deserialized Colorspace.\n"); } +static void fuzz_path_deserialize(sk_sp<SkData> bytes) { + SkPath path; + if (!path.readFromMemory(bytes->data(), bytes->size())) { + SkDebugf("[terminated] Couldn't initialize SkPath.\n"); + return; + } + SkDebugf("[terminated] Success! Initialized SkPath.\n"); +} + #if SK_SUPPORT_GPU static void fuzz_sksl2glsl(sk_sp<SkData> bytes) { SkSL::Compiler compiler; |