aboutsummaryrefslogtreecommitdiffhomepage
path: root/fuzz/fuzz.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2018-01-09 15:32:58 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-09 21:02:17 +0000
commitedef8ec4b24f9d2ce76e4c53304e25853888bee4 (patch)
tree37111a6a064457687789e5b7bf77c19103465d71 /fuzz/fuzz.cpp
parentfca3d0aba5a7d17dbf97082b6837e31ff2808b4f (diff)
Refactor SerializedImageFilter to avoid duplicate code
After this CL, we have 3.5 options for fuzzing ImageFilter 1. Create it from API calls and then draw it fuzz -t api -n ImageFilter -b [input] 2. Deserialize a fuzzed stream into an ImageFilter (this is what Chromium's filter_fuzz_stub does) fuzz -t filter_fuzz -b [input] 3. Create an ImageFilter from API calls, serialize it, apply some mutations to the stream, deserialize it, then draw it. fuzz -t api -n SerializedImageFilter -b [input] 3.5 Create ImageFilters as part of our more general canvas fuzzers. fuzz -t api -n RasterN32Canvas -b [input] (and others) Previously, the SerializedImageFilter had its own, slightly stale and prone to stack-overflow way of making an image filter. This CL re-uses what we already do for Canvas fuzzing and removes that dead code. Additionally, there is a way to easily generate a corpus for the filter_fuzz type, via SerializedImageFilter. Bug: skia: Change-Id: I31bb4ffce2abf1c1a6d0a7000e5aceb8d7b38b65 Reviewed-on: https://skia-review.googlesource.com/92142 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'fuzz/fuzz.cpp')
-rw-r--r--fuzz/fuzz.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp
index 0d19027d6e..45298ca871 100644
--- a/fuzz/fuzz.cpp
+++ b/fuzz/fuzz.cpp
@@ -555,15 +555,13 @@ static void fuzz_textblob_deserialize(sk_sp<SkData> bytes) {
}
static void fuzz_filter_fuzz(sk_sp<SkData> bytes) {
-
const int BitmapSize = 24;
SkBitmap bitmap;
bitmap.allocN32Pixels(BitmapSize, BitmapSize);
SkCanvas canvas(bitmap);
canvas.clear(0x00000000);
- sk_sp<SkImageFilter> flattenable = SkValidatingDeserializeImageFilter(
- bytes->data(), bytes->size());
+ auto flattenable = SkImageFilter::Deserialize(bytes->data(), bytes->size());
// Adding some info, but the test passed if we got here without any trouble
if (flattenable != nullptr) {