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); } |