-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Labels
Description
Hi, I recently fuzz the libdeflate for parsing zlib format file and found some interesting cases.
Specifically, libdeflate accepts the file without any issue while another parser, the zlib rejects it, and I also contacted the zlib authors.
To check it whether valid or not, I use the following code (mainly from zlib_decompress/fuzz.c)
int main(int argc, char **argv)
{
struct libdeflate_decompressor *d;
int ret;
int fd = open(argv[1], O_RDONLY);
struct stat stbuf;
assert(fd >= 0);
ret = fstat(fd, &stbuf);
assert(!ret);
char in[stbuf.st_size];
ret = read(fd, in, sizeof in);
assert(ret == sizeof in);
char out[sizeof(in) * 30];
d = libdeflate_alloc_decompressor();
size_t out_size = 0 ;
enum libdeflate_result res = libdeflate_zlib_decompress(d, in, sizeof in, out, sizeof out, &out_size);
printf("decode res:%d\n", res);
libdeflate_free_decompressor(d);
return 0;
}
These interesting files are attached!
pocs.zip