Deflate not inflating properly

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e3c34d22ea1a7290d105afd1b09ea3df

I'm trying to decompress some data that's encoded in Zlib format, without gzip headers.
The Playground snippet above shows flate2 insisting the data is corrupted.
But if I plug the same data into Free online text compression tools - gzip, bzip2 and deflate
it decompresses properly. While that output looks random, it's actually valid; it's binary LLSD,which is roughly equivalent to JSON.

The data begins with 78 DA in hex, so it's DEFLATE format.

I tried using "libflate", and that rejects it with "LEN=30170 is not the one's complement of NLEN=19282".

The 78 DA bytes are a zlib header. You can use ZlibDecoder to decode this stream (playground).

2 Likes

Ah. Much better. Now decoding data OK. Thanks.