0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 01:37:56 +08:00

Problem: z85_decode fuzzer fails if fewer than 5 bytes are passed

Solution: check immediately the size of the input
This commit is contained in:
Luca Boccassi 2020-05-21 10:22:35 +01:00
parent c1d195641d
commit 51c90a6cd5

View File

@ -41,6 +41,9 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
{
uint8_t *secret_key;
if (size < 5)
return 0;
// As per API definition, input must be divisible by 5, so truncate it if it's not
size -= size % 5;
// As per API definition, the destination must be at least 0.8 times the input data