aboutsummaryrefslogtreecommitdiffhomepage
path: root/fuzz
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2018-01-11 14:50:21 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-11 20:19:48 +0000
commit54f20e0df694d0428442827bd0534afd579682ce (patch)
tree660d22320935280819256ff6fc062f34134685a8 /fuzz
parent1f096ac6abf10dccae190b63f8a0474139f05983 (diff)
Fix invalid switch in FuzzCanvas
Also tweak when we report OOM - AFL-fuzz is fine, but libfuzzer should abort, not exit. Bug: skia: Change-Id: Ic19277bbceec5e7c0ac966d6d9ac677bcfebcfae Reviewed-on: https://skia-review.googlesource.com/93201 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Hal Canary <halcanary@google.com>
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/FuzzCanvas.cpp10
-rw-r--r--fuzz/FuzzCommon.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 61e51f2157..2e70024bd5 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -135,6 +135,7 @@ inline void Fuzz::next(SkMatrix* m) {
m->set9(buffer);
return;
default:
+ SkASSERT(false);
return;
}
}
@@ -223,6 +224,9 @@ static sk_sp<SkColorFilter> make_fuzz_colorfilter(Fuzz* fuzz, int depth) {
fuzz->nextN(tableB, SK_ARRAY_COUNT(tableB));
return SkTableColorFilter::MakeARGB(tableA, tableR, tableG, tableB);
}
+ default:
+ SkASSERT(false);
+ break;
}
return nullptr;
}
@@ -411,6 +415,7 @@ static sk_sp<SkShader> make_fuzz_shader(Fuzz* fuzz, int depth) {
}
}
default:
+ SkASSERT(false);
break;
}
return nullptr;
@@ -608,7 +613,7 @@ static sk_sp<SkImageFilter> make_fuzz_imageFilter(Fuzz* fuzz, int depth) {
return nullptr;
}
uint8_t imageFilterType;
- fuzz->nextRange(&imageFilterType, 0, 24);
+ fuzz->nextRange(&imageFilterType, 0, 23);
switch (imageFilterType) {
case 0:
return nullptr;
@@ -1023,6 +1028,7 @@ static SkTDArray<uint8_t> make_fuzz_text(Fuzz* fuzz, const SkPaint& paint) {
break;
default:
SkASSERT(false);
+ break;
}
return array;
}
@@ -1065,6 +1071,7 @@ static sk_sp<SkTextBlob> make_fuzz_textblob(Fuzz* fuzz) {
break;
default:
SkASSERT(false);
+ break;
}
}
return textBlobBuilder.make();
@@ -1663,6 +1670,7 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) {
break;
}
default:
+ SkASSERT(false);
break;
}
}
diff --git a/fuzz/FuzzCommon.h b/fuzz/FuzzCommon.h
index a538280c8c..f0efc19a1a 100644
--- a/fuzz/FuzzCommon.h
+++ b/fuzz/FuzzCommon.h
@@ -65,6 +65,7 @@ static void fuzz_path(Fuzz* fuzz, SkPath* path, int maxOps) {
path->close();
break;
default:
+ SkASSERT(false);
break;
}
}