ende76 / brotli-rs

A Brotli implementation in pure and safe Rust
Apache License 2.0
64 stars 19 forks source link

Panic while decompressing #12

Closed frewsxcv closed 8 years ago

frewsxcv commented 8 years ago
extern crate brotli;

use std::io::Read;
use brotli::Decompressor;

fn main() {
    let mut input = vec![];
    let _ = Decompressor::new(&b"\x51\xac\x00\x48\x2f\x73\x14\x01\x14\x00\x00\x01\x00\x14\x14\xff\x00\x02\x00\x00\x00\x00\x00\x64\x14\x24\x14\x14\x14\x14\x14\x80\x00\x00\x14\xff\xff\x00\x00\x14\x14\x14\x14\x14\x14\x80\x00\x80".to_vec() as &[u8]).read_to_end(&mut input);
}

Crash discovered using afl.rs

ende76 commented 8 years ago

I'm repeating myself, but I still can't believe how valuable afl is… I tried setting it up on my machine, but failed to get it to work, even after compiling rustc from source. I was a bit hesitant to abandon my multirust install, but maybe I need to go all the way from source. It does seem like afl would be worth it.

frewsxcv commented 8 years ago

If you install Vagrant, you can use the Vagrantfile that lives in the repo. It'll set up Rust, Cargo, and AFL to versions that are confirmed to work with afl.rs; this is how I am testing everything. I'm planning to write better documentation and a tutorial sometime this week for it to explain how to set it up and use it step by step. Let me know if you need any help!