Fuzzing for Vec<u8>
This commit is contained in:
parent
274bdd491d
commit
68017b66fd
@ -83,3 +83,11 @@ path = "fuzz_targets/fuzz_target_address_decode.rs"
|
||||
[[bin]]
|
||||
name = "fuzz_target_address_encode"
|
||||
path = "fuzz_targets/fuzz_target_address_encode.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "fuzz_target_vec_decode"
|
||||
path = "fuzz_targets/fuzz_target_vec_decode.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "fuzz_target_vec_encode"
|
||||
path = "fuzz_targets/fuzz_target_vec_encode.rs"
|
||||
|
21
eth2/utils/ssz/fuzz/fuzz_targets/fuzz_target_vec_decode.rs
Normal file
21
eth2/utils/ssz/fuzz/fuzz_targets/fuzz_target_vec_decode.rs
Normal file
@ -0,0 +1,21 @@
|
||||
#![no_main]
|
||||
#[macro_use] extern crate libfuzzer_sys;
|
||||
extern crate ethereum_types;
|
||||
extern crate ssz;
|
||||
|
||||
use ethereum_types::{Address, H256};
|
||||
use ssz::{DecodeError, Decodable};
|
||||
|
||||
// Fuzz ssz_decode()
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let _result: Result<(Vec<u8>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
/*
|
||||
let _result: Result<(Vec<u16>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
let _result: Result<(Vec<u32>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
let _result: Result<(Vec<u64>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
let _result: Result<(Vec<usize>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
let _result: Result<(Vec<Address>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
let _result: Result<(Vec<H256>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
let _result: Result<(Vec<bool>, usize), DecodeError> = Decodable::ssz_decode(data, 0);
|
||||
*/
|
||||
});
|
15
eth2/utils/ssz/fuzz/fuzz_targets/fuzz_target_vec_encode.rs
Normal file
15
eth2/utils/ssz/fuzz/fuzz_targets/fuzz_target_vec_encode.rs
Normal file
@ -0,0 +1,15 @@
|
||||
#![no_main]
|
||||
#[macro_use] extern crate libfuzzer_sys;
|
||||
extern crate ethereum_types;
|
||||
extern crate ssz;
|
||||
|
||||
use ethereum_types::{Address, H256};
|
||||
use ssz::SszStream;
|
||||
|
||||
// Fuzz ssz_decode()
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
|
||||
let mut ssz = SszStream::new();
|
||||
let data_vec = data.to_vec();
|
||||
ssz.append(&data_vec);
|
||||
});
|
Loading…
Reference in New Issue
Block a user