You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This minimal example is never returning with the current master (3032f37).
externcrate bzip2;use bzip2::write::BzDecoder;use std::io::prelude::*;fnmain(){letmut d = BzDecoder::new(Vec::new());
d.write(b"").unwrap();
d.finish().unwrap();}
With a similar test case cargo test was stuck:
#[test]fnwrite_empty(){let d = BzDecoder::new(Vec::new());letmut c = BzEncoder::new(d,::Compression::default());
c.write(b"").unwrap();let data = c.finish().unwrap().finish().unwrap();assert_eq!(&data[..],b"");}
Diving into the simpler example traceback the problem seems related to try_finish in write.rs, where we are writing an empty buffer forever:
Maybe it is sufficient to check if we received some input? Like:
pubfntry_finish(&mutself) -> io::Result<()>{// If nothing entered, there is no need to loopwhile !self.done && self.total_in() != 0{self.write(&[])?;}self.dump()}
That done cargo test works with the added test too.
Let me know if you'd like a Pull Request, it's ready on my disk.
The text was updated successfully, but these errors were encountered:
naufraghi
added a commit
to naufraghi/bzip2-rs
that referenced
this issue
May 29, 2023
This minimal example is never returning with the current master (3032f37).
With a similar test case
cargo test
was stuck:Diving into the simpler example traceback the problem seems related to
try_finish
inwrite.rs
, where we are writing an empty buffer forever:Maybe it is sufficient to check if we received some input? Like:
That done
cargo test
works with the added test too.Let me know if you'd like a Pull Request, it's ready on my disk.
The text was updated successfully, but these errors were encountered: