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

Unified Diff: fuzz/fuzz.cpp

Issue 2089783003: Add deserialize color space entry point for fuzzing (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fuzz/fuzz.cpp
diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp
index 853b5e04117b4732af8adaa80b2974221d7ed70b..b8375d344a1e9a6ce1099d97d5661f9562e74a94 100644
--- a/fuzz/fuzz.cpp
+++ b/fuzz/fuzz.cpp
@@ -36,6 +36,7 @@ static int fuzz_api(SkData*);
static int fuzz_img(SkData*, uint8_t, uint8_t);
static int fuzz_skp(SkData*);
static int fuzz_icc(SkData*);
+static int fuzz_color_deserialize(SkData*);
int main(int argc, char** argv) {
SkCommandLineFlags::Parse(argc, argv);
@@ -53,6 +54,8 @@ int main(int argc, char** argv) {
switch (FLAGS_type[0][0]) {
case 'a': return fuzz_api(bytes);
+ case 'c': return fuzz_color_deserialize(bytes);
+
case 'i':
if (FLAGS_type[0][1] == 'c') { //icc
return fuzz_icc(bytes);
@@ -386,6 +389,16 @@ int fuzz_icc(SkData* bytes) {
return 0;
}
+int fuzz_color_deserialize(SkData* bytes) {
+ sk_sp<SkColorSpace> space(SkColorSpace::Deserialize(bytes->data(), bytes->size()));
+ if (!space) {
+ SkDebugf("[terminated] Couldn't deserialize Colorspace.\n");
+ return 1;
+ }
+ SkDebugf("[terminated] Success! deserialized Colorspace.\n");
+ return 0;
+}
+
Fuzz::Fuzz(SkData* bytes) : fBytes(SkSafeRef(bytes)), fNextByte(0) {}
void Fuzz::signalBug () { SkDebugf("Signal bug\n"); raise(SIGSEGV); }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698