image-rs / deflate-rs

An implementation of a DEFLATE encoder in rust
Apache License 2.0
53 stars 14 forks source link

Encoding huffman length values sometimes missing trailing zero. #11

Closed oyvindln closed 7 years ago

oyvindln commented 7 years ago

Encoding huffman length values misses a trailing zero value if the last few length values before it results in outputting the code for repeating the previous length value. If this happens, decoding the data will result in garbage. As this can only happen with data that ends up producing no distance values as any subsequent zeroes are ignored when encoding, it's exceedingly rare for this to actually occur.

A fix is incoming.

oyvindln commented 7 years ago

Fixed in 02004bfbf9c1a36d60189b103ffd1ea57493b73f