Skip fuzz inputs that have more than 64 chunks

This commit is contained in:
Justin Azoff 2020-05-20 09:44:06 -04:00
parent fda8b98ac7
commit 1e4374bd27
4 changed files with 28 additions and 0 deletions

View file

@ -17,6 +17,23 @@ bool zeek::detail::FuzzBuffer::Valid() const
return true;
}
int zeek::detail::FuzzBuffer::ChunkCount() const
{
auto pos = begin;
int chunks = 0;
while (pos < end)
{
pos = (const unsigned char*)memmem(pos, end - pos,
PKT_MAGIC, PKT_MAGIC_LEN);
if ( ! pos )
break;
pos += PKT_MAGIC_LEN + 1;
chunks++;
}
return chunks;
}
std::optional<zeek::detail::FuzzBuffer::Chunk> zeek::detail::FuzzBuffer::Next()
{
if ( begin == end )