mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Improve FuzzBuffer chunking
Now allocates a new buffer for each chunk to better detect over-reads
This commit is contained in:
parent
8e6539b55f
commit
2922bf71b6
3 changed files with 37 additions and 28 deletions
|
@ -53,28 +53,22 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
|||
auto conn = add_connection();
|
||||
auto a = add_analyzer(conn);
|
||||
|
||||
const unsigned char* chunk;
|
||||
size_t chunk_size;
|
||||
bool is_orig;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
auto err = fb.Next(&chunk, &chunk_size, &is_orig);
|
||||
auto chunk = fb.Next();
|
||||
|
||||
if ( err )
|
||||
break;
|
||||
|
||||
if ( chunk_size == 0 )
|
||||
if ( ! chunk )
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
a->DeliverStream(chunk_size, chunk, is_orig);
|
||||
a->DeliverStream(chunk->size, chunk->data.get(), chunk->is_orig);
|
||||
}
|
||||
catch ( const binpac::Exception& e )
|
||||
{
|
||||
}
|
||||
|
||||
chunk = {};
|
||||
mgr.Drain();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue