Panic when decompressing
frewsxcv opened this issue · comments
extern crate brotli;
use std::io::Read;
use brotli::Decompressor;
fn main() {
let mut input = vec![];
let _ = Decompressor::new(&b"\xb1".to_vec() as &[u8]).read_to_end(&mut input);
}
coreyf@frewbook-pro /t/meow (master)> cargo run
Running `target/debug/meow`
thread '<main>' panicked at '"Encountered unexpected EOF"', /Users/coreyf/.cargo/git/checkouts/brotli-rs-33811c30552ad7ba/master/src/lib.rs:2280
Process didn't exit successfully: `target/debug/meow` (exit code: 101)
Panic discovered using afl.rs
Ah yes, thanks again. This was more my inexperience with Rust conventions than anything else. Now, instead of panicking outright, read() properly passes through the possible error conditions.