updates to OSS-Fuzz integration

adapt more fuzz targets from zlib,
add zip fuzzer, zip dictionary.
update uncompress_fuzzer to seed the buffer length separately.
This commit is contained in:
Randy
2020-11-24 16:51:30 +01:00
parent cd65995953
commit b485d01faf
10 changed files with 466 additions and 7 deletions

View File

@@ -10,18 +10,21 @@
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
unsigned long int buffer_length = 1;
unsigned long int buffer_length;
unsigned char *buffer = NULL;
int z_status = 0;
if (size > 0)
buffer_length *= data[0];
if (size > 1)
buffer_length *= data[1];
if(size > 4) return 0;
uint32_t n;
memcpy(&n, data, 4);
buffer_length = n;
if(buffer_length > (1024 * 256)) return 0;
buffer = (unsigned char *)malloc(buffer_length);
z_status = uncompress(buffer, &buffer_length, data, size);
z_status = uncompress(buffer, &buffer_length, data + 4, size - 4);
free(buffer);
if (Z_OK != z_status)