zstr icon indicating copy to clipboard operation
zstr copied to clipboard

zlib header detection is too restrictive.

Open madler opened this issue 5 years ago • 7 comments

This statement looks only for three specific possible zlib headers. There are many more valid zlib headers that would be missed. 61 to be precise. Look at RFC 1950 for the definition of a zlib header.

madler avatar Dec 28 '20 16:12 madler

Thanks for the report. Bug confirmed. See also https://stackoverflow.com/questions/9050260/what-does-a-zlib-header-look-like If you have a patch, please feel free to submit a PR.

ferdymercury avatar Dec 28 '20 19:12 ferdymercury

It looks like you already know to use inflateInit2() with 15+32 in order to auto-detect the format. What you're looking for is already built into zlib's inflate.

madler avatar Dec 29 '20 08:12 madler

(I am not the author of the software, just an end user / collaborator with admin rights as the original author dropped the project support)

ferdymercury avatar Dec 29 '20 12:12 ferdymercury