Add basic structure for fuzzing targets

General changes:

* Add -D/--deterministic command line option as
  convenience/alternative to -G/--load-seeds (i.e. no file needed, it just
  uses zero-initialized random seeds).  It also changes Broker data
  stores over to using deterministic timing rather than real time.

* Add option to make Reporter abort on runtime scripting errors
This commit is contained in:
Jon Siwek 2020-04-21 20:16:00 -07:00
parent f849571910
commit 8f1b34b915
20 changed files with 1290 additions and 928 deletions

24
src/fuzzers/FuzzBuffer.h Normal file
View file

@ -0,0 +1,24 @@
#pragma once
#include <cstddef>
namespace zeek {
struct FuzzBuffer {
static constexpr int PKT_MAGIC_LEN = 4;
static constexpr unsigned char PKT_MAGIC[PKT_MAGIC_LEN + 1] = "\1PKT";
FuzzBuffer(const unsigned char* data, size_t size)
: begin(data), end(data + size)
{ }
bool Valid() const;
int Next(const unsigned char** chunk, size_t* len, bool* is_orig);
const unsigned char* begin;
const unsigned char* end;
};
} // namespace zeek