rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust
https://docs.rs/flate2
Apache License 2.0
862 stars 159 forks source link

Fix header CRC calculation of trailing zeros #363

Closed jongiddy closed 11 months ago

jongiddy commented 11 months ago

Having said #323 was good, I then found an error: b"0" being used where b"\0" is needed. It causes a false corrupt error if a gzipped file includes a filename or comment and also has the header CRC.

To test I re-implemented the CRC from the RFC directly. This confirms that the CRC used in the library is correct.