sile / libflate

A Rust implementation of DEFLATE algorithm and related formats (ZLIB, GZIP)
https://docs.rs/libflate
MIT License
178 stars 35 forks source link

Panic in `bug` when parsing malformed file #64

Closed 5225225 closed 2 years ago

5225225 commented 2 years ago
#[test]
fn test_bug() {
    let input = b"\x04\x04\x04\x05:\x1az*\xfc\x06\x01\x90\x01\x06\x01";
    let mut decoder = Decoder::new(&input[..]);

    let result = io::copy(&mut decoder, &mut io::sink());
}
thread 'deflate::decode::tests::test_bug' panicked at 'bug', src/huffman.rs:124:43
sile commented 2 years ago

Thank you for creating this issue. I'll start investigating this problem within a week. BTW, there are multiple "Decoder" structs in libflate ( https://docs.rs/libflate/latest/libflate/?search=decoder ). So could you give me the module name of the above Decoder struct?

5225225 commented 2 years ago

Ah, my bad. I put that test in deflate/decode.rs, it's the DEFLATE decoder.

sile commented 2 years ago

Thank you!

sile commented 2 years ago

Fixed in #65. Thanks again for reporting this problem.