Zlib header stores incorrect wbits value when hist_bits is set to other values than 15.
- Dominant language
- C
- Stars
- 1.1k
- Forks
- 346
- PR merge metrics
- No merged PRs in 30d
Description
This is an issue I encountered when working on the python bindings.
When creating a `isal_zstream` and setting `gzip_flag` to `IGZIP_ZLIB` it can only be decompressed with zlib if wbits is set to 15, regardless of the hist_bits parameter on the isal_zstream.
For example, using gzip_flag=IGZIP_ZLIB and hist_bits=10, it can still only be decompressed using zlib and wbits=15
I had to add a workaround in my test suite: https://github.com/pycompression/python-isal/blob/374fe82ddd3f87c0316f923282787097d5817983/tests/test_compat.py#L102
I have made sure the isal_zstream was set with the right parameters before posting this bug. There is some conversion code that makes the ISA-L interface accessible to a python zlib interface, but I made sure the issue is not in the conversion.
What does work properly:
- The IGZIP_GZIP and IGZIP_DEFLATE flags do not cause problems.
- Creating zlib data using zlib and decompressing with ISA-L with corresponding window bits.
- Creating zlib data using ISA-L and decompressing with ISA-L with corresponding window bits.
In these cases using a window size for decompression that is smaller than the window size for compressing leads to an error, as expected. Using the same window sizes works correctly.
Regardless this is not a dramatically important issue, as there is almost no use case for using a window size less than MAX_HIST_BITS.
Contributor guide
Assessment
This issue has not been assessed yet.