Copying the issue from miniz_oxide: Frommi/miniz_oxide#174
xref: milesgranger/cramjam#211
Seems a decompression error only arrives if the bad input data is over 4 characters long:
This does not raise an error:
fn decompress_bad_data() {
let mut decoder = DeflateDecoder::new(b"1".as_slice());
let mut out = vec![];
assert!(std::io::copy(&mut decoder, &mut out).is_err());
}
But this will, 5 bytes at least for me, seems to spark the error, up to 4 bytes will not raise an error.
fn decompress_bad_data() {
let mut decoder = DeflateDecoder::new(b"12345".as_slice());
let mut out = vec![];
assert!(std::io::copy(&mut decoder, &mut out).is_err());
}
And as pointed out in the linked issue, it actually depends on what the first byte is on whether it fails as expected or not - further adding to the awkwardness.
Copying the issue from miniz_oxide: Frommi/miniz_oxide#174
xref: milesgranger/cramjam#211
Seems a decompression error only arrives if the bad input data is over 4 characters long:
This does not raise an error:
But this will, 5 bytes at least for me, seems to spark the error, up to 4 bytes will not raise an error.
And as pointed out in the linked issue, it actually depends on what the first byte is on whether it fails as expected or not - further adding to the awkwardness.