From 2541edf0c6f9dc6897853efe546b5c215034ad49 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Thu, 11 Jan 2018 10:27:14 -0500 Subject: Add in Region SetPath Fuzzer Also refactor a few things to make it easier to use oss-fuzz. Bug: skia: Change-Id: Ie518a6cfc7d57a347b5d09089379f986d33f8b7f Reviewed-on: https://skia-review.googlesource.com/41740 Commit-Queue: Kevin Lubick Reviewed-by: Mike Klein --- fuzz/Fuzz.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'fuzz/Fuzz.h') diff --git a/fuzz/Fuzz.h b/fuzz/Fuzz.h index 1a2aa381d0..9dad0595e7 100644 --- a/fuzz/Fuzz.h +++ b/fuzz/Fuzz.h @@ -14,15 +14,18 @@ #include "SkTypes.h" #include +#include class Fuzz : SkNoncopyable { public: - explicit Fuzz(sk_sp); + explicit Fuzz(sk_sp bytes) : fBytes(bytes), fNextByte(0) {} // Returns the total number of "random" bytes available. - size_t size(); + size_t size() { return fBytes->size(); } // Returns if there are no bytes remaining for fuzzing. - bool exhausted(); + bool exhausted(){ + return fBytes->size() == fNextByte; + } // next() loads fuzzed bytes into the variable passed in by pointer. // We use this approach instead of T next() because different compilers @@ -47,7 +50,11 @@ public: template void nextN(T* ptr, int n); - void signalBug(); // Tell afl-fuzz these inputs found a bug. + void signalBug(){ + // Tell the fuzzer that these inputs found a bug. + SkDebugf("Signal bug\n"); + raise(SIGSEGV); + } private: template -- cgit v1.2.3