rust-fuzz/targets

fuzz minidump crate

frewsxcv opened this issue · 5 comments

https://twitter.com/TedMielczarek/status/943922075428941830

I saw the word 'parser' and the fuzzing portion of my brain lit up

luser commented

A solid plan. :) The parser itself is probably not the best code, I was pretty new at Rust when I wrote most of it.

luser commented

There's a Minidump::read method that takes anything that implements Read + Seek, so it's pretty easy to stick bytes in a Cursor and parse it. Note that it doesn't parse the whole file with that, just the header and the stream directory. You can call Minidump::get_stream with individual stream types to get them to parse.

i threw together a fuzz target:

#![no_main]

#[macro_use] extern crate libfuzzer_sys;
extern crate minidump;

use minidump::Minidump;
use std::io::Cursor;

fuzz_target!(|data: &[u8]| {
    let cursor = Cursor::new(data);
    minidump::Minidump::read(cursor);
});

though it currently doesn't compile because Minidump::read requires 'static on the single argument. any reason why this needs a static lifetime?

opened a github issue with a couple associated pull requests: rust-minidump/rust-minidump#6