mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Merge remote-tracking branch 'origin/master' into topic/johanna/hash-unification
* origin/master: Use zeek::detail namespace for fuzzer utils Set terminating flag during fuzzer cleanup Add missing include to standalone fuzzer driver Improve standalone fuzzer driver error messages Test fuzzers against seed corpus under CI ASan build Update fuzzing README with OSS-Fuzz integration notes Link fuzzers against shared library to reduce executable sizes Improve FuzzBuffer chunking Fix compiler warning in standalone fuzzer driver Adjust minor fuzzing documentation Exit immediately after running unit tests Add OSS-Fuzz Zeek script search path to fuzzers Assume libFuzzer when LIB_FUZZING_ENGINE file doesn't exist Change handling of LIB_FUZZING_ENGINE Change --enable-fuzzing to --enable-fuzzers Add standalone driver for fuzz targets Add basic structure for fuzzing targets
This commit is contained in:
commit
892023ed9a
30 changed files with 1703 additions and 932 deletions
37
src/util.cc
37
src/util.cc
|
@ -1089,7 +1089,8 @@ void bro_srandom(unsigned int seed)
|
|||
srandom(seed);
|
||||
}
|
||||
|
||||
void init_random_seed(const char* read_file, const char* write_file)
|
||||
void init_random_seed(const char* read_file, const char* write_file,
|
||||
bool use_empty_seeds)
|
||||
{
|
||||
std::array<uint32_t, KeyedHash::SEED_INIT_SIZE> buf = {};
|
||||
size_t pos = 0; // accumulates entropy
|
||||
|
@ -1104,6 +1105,8 @@ void init_random_seed(const char* read_file, const char* write_file)
|
|||
else
|
||||
seeds_done = true;
|
||||
}
|
||||
else if ( use_empty_seeds )
|
||||
seeds_done = true;
|
||||
|
||||
#ifdef HAVE_GETRANDOM
|
||||
if ( ! seeds_done )
|
||||
|
@ -1724,6 +1727,38 @@ static string find_file_in_path(const string& filename, const string& path,
|
|||
return string();
|
||||
}
|
||||
|
||||
std::string get_exe_path(const std::string& invocation)
|
||||
{
|
||||
if ( invocation.empty() )
|
||||
return "";
|
||||
|
||||
if ( invocation[0] == '/' || invocation[0] == '~' )
|
||||
// Absolute path
|
||||
return invocation;
|
||||
|
||||
if ( invocation.find('/') != std::string::npos )
|
||||
{
|
||||
// Relative path
|
||||
char cwd[PATH_MAX];
|
||||
|
||||
if ( ! getcwd(cwd, sizeof(cwd)) )
|
||||
{
|
||||
fprintf(stderr, "failed to get current directory: %s\n",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return std::string(cwd) + "/" + invocation;
|
||||
}
|
||||
|
||||
auto path = getenv("PATH");
|
||||
|
||||
if ( ! path )
|
||||
return "";
|
||||
|
||||
return find_file(invocation, path);
|
||||
}
|
||||
|
||||
string find_file(const string& filename, const string& path_set,
|
||||
const string& opt_ext)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue