aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-02-22 12:50:25 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-22 12:50:26 -0800
commitca726abe1e4a2522b24e5143c5faf0e594a4802a (patch)
tree82aeae3da478bb96e94d8c152ec9646baa799ba9 /samplecode
parentd49a86ade0bab1fc3048d6ba5d8536abf25ed77c (diff)
fix misc asserts and checks found by fuzzer
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleFilterFuzz.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index f8ceed452c..687921ae0b 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -204,7 +204,7 @@ static SkTypeface::Style make_typeface_style() {
}
static SkPath1DPathEffect::Style make_path_1d_path_effect_style() {
- return static_cast<SkPath1DPathEffect::Style>(R(SkPath1DPathEffect::kStyleCount));
+ return static_cast<SkPath1DPathEffect::Style>(R((int)SkPath1DPathEffect::kLastEnum_Style + 1));
}
static SkColor make_color() {
@@ -527,9 +527,14 @@ static SkPaint make_paint() {
paint.setXfermodeMode(make_xfermode());
paint.setPathEffect(make_path_effect());
paint.setMaskFilter(make_mask_filter());
- SkAutoTUnref<SkTypeface> typeface(
- SkTypeface::CreateFromName(make_font_name().c_str(), make_typeface_style()));
- paint.setTypeface(typeface);
+
+ if (false) {
+ // our validating buffer does not support typefaces yet, so skip this for now
+ SkAutoTUnref<SkTypeface> typeface(
+ SkTypeface::CreateFromName(make_font_name().c_str(), make_typeface_style()));
+ paint.setTypeface(typeface);
+ }
+
SkLayerRasterizer::Builder rasterizerBuilder;
SkPaint paintForRasterizer;
if (R(2) == 1) {