Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: samplecode/SampleFilterFuzz.cpp

Issue 1719993002: fix misc asserts and checks found by fuzzer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: hide the creation of the typeface as well Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkDashPathEffect.h ('k') | src/effects/Sk1DPathEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleFilterFuzz.cpp
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index f8ceed452cd4bb4229b4748101057519266769f4..687921ae0bdb19dd256da4c894b62fd0f49a6d95 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) {
« no previous file with comments | « include/effects/SkDashPathEffect.h ('k') | src/effects/Sk1DPathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698