mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/jazoff/packet-fuzzer'
* origin/topic/jazoff/packet-fuzzer: Update src/fuzzers/packet-fuzzer.cc Update src/fuzzers/packet-fuzzer.cc add initial packet corpus add packet fuzzer
This commit is contained in:
commit
2bac702a72
5 changed files with 58 additions and 1 deletions
11
CHANGES
11
CHANGES
|
@ -1,4 +1,15 @@
|
|||
|
||||
3.2.0-dev.547 | 2020-05-18 10:47:54 -0700
|
||||
|
||||
* add packet fuzzer (Justin Azoff)
|
||||
|
||||
* Fix building fuzz targets on macOS (Jon Siwek, Corelight)
|
||||
|
||||
* Highwayhash: small build fix (Johanna Amann, Corelight)
|
||||
|
||||
Turns out that hh_neon should not be compiled on generic arm CPUs.
|
||||
That one is only for aarch64.
|
||||
|
||||
3.2.0-dev.539 | 2020-05-15 19:47:55 +0000
|
||||
|
||||
* Replace bzero() with memset() (Noah Treuhaft)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.2.0-dev.539
|
||||
3.2.0-dev.547
|
||||
|
|
|
@ -79,3 +79,4 @@ target_link_libraries(zeek_fuzzer_shared
|
|||
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
|
||||
|
||||
add_fuzz_target(pop3)
|
||||
add_fuzz_target(packet)
|
||||
|
|
BIN
src/fuzzers/packet-corpus.zip
Normal file
BIN
src/fuzzers/packet-corpus.zip
Normal file
Binary file not shown.
45
src/fuzzers/packet-fuzzer.cc
Normal file
45
src/fuzzers/packet-fuzzer.cc
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "binpac.h"
|
||||
|
||||
#include "iosource/Packet.h"
|
||||
#include "Event.h"
|
||||
#include "Sessions.h"
|
||||
|
||||
#include "FuzzBuffer.h"
|
||||
#include "fuzzer-setup.h"
|
||||
|
||||
#include "pcap/dlt.h"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
zeek::detail::FuzzBuffer fb{data, size};
|
||||
|
||||
if ( ! fb.Valid() )
|
||||
return 0;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
auto chunk = fb.Next();
|
||||
|
||||
if ( ! chunk )
|
||||
break;
|
||||
|
||||
Packet pkt;
|
||||
auto timestamp = 42;
|
||||
pkt_timeval ts = {timestamp, 0};
|
||||
pkt.Init(DLT_RAW, &ts, chunk->size, chunk->size, chunk->data.get(), false, "");
|
||||
|
||||
try
|
||||
{
|
||||
sessions->NextPacket(timestamp, &pkt);
|
||||
}
|
||||
catch ( binpac::Exception const &e )
|
||||
{
|
||||
}
|
||||
|
||||
chunk = {};
|
||||
mgr.Drain();
|
||||
}
|
||||
|
||||
zeek::detail::fuzzer_cleanup_one_input();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue