diff options
author | Kevin Lubick <kjlubick@google.com> | 2018-01-11 10:27:14 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-11 19:42:53 +0000 |
commit | 2541edf0c6f9dc6897853efe546b5c215034ad49 (patch) | |
tree | ed23f1aadc624f27fde4e2f53c6960488152b42f /fuzz/Fuzz.h | |
parent | b5ef1f9b13e36a427dd6350986d41db208b2df1b (diff) |
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 <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'fuzz/Fuzz.h')
-rw-r--r-- | fuzz/Fuzz.h | 15 |
1 files changed, 11 insertions, 4 deletions
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 <cmath> +#include <signal.h> class Fuzz : SkNoncopyable { public: - explicit Fuzz(sk_sp<SkData>); + explicit Fuzz(sk_sp<SkData> 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 <typename T> 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 <typename T> |