Trick event handlers into returning that they exist during fuzzing

This commit is contained in:
Tim Wojtulewicz 2022-08-03 16:40:56 -07:00
parent 0b8615942d
commit 7f47fa24fd
4 changed files with 28 additions and 10 deletions

View file

@ -4,6 +4,7 @@
#include <cstdlib>
#include "zeek/Event.h"
#include "zeek/EventRegistry.h"
#include "zeek/broker/Manager.h"
#include "zeek/file_analysis/Manager.h"
#include "zeek/session/Manager.h"
@ -41,6 +42,11 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
if ( zeek::detail::setup(*argc, *argv, &options).code )
abort();
// We have to trick the event handlers into returning true that they exist here
// even if they don't, because otherwise we lose a bit of coverage where if
// statements return false that would otherwise not.
zeek::event_registry->ActivateAllHandlers();
return 0;
}