Write a fuzz test

This commit is contained in:
Kirk Baird 2019-02-20 14:46:25 +11:00
parent 3517ef6513
commit 52347d8e6d
No known key found for this signature in database
GPG Key ID: BF864B7ED0BEA33F
3 changed files with 12 additions and 9 deletions

View File

@ -18,5 +18,5 @@ git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
members = ["."]
[[bin]]
name = "fuzz_target_1"
path = "fuzz_targets/fuzz_target_1.rs"
name = "fuzz_target_u8"
path = "fuzz_targets/fuzz_target_u8.rs"

View File

@ -1,7 +0,0 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate ssz;
fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
});

View File

@ -0,0 +1,10 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate ssz;
use ssz::{DecodeError, Decodable, Encodable};
// Fuzz ssz_decode(u8)
fuzz_target!(|data: &[u8]| {
let result: Result<(u8, usize), DecodeError> = Decodable::ssz_decode(data, 0);
});