X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Ffuzz_targets%2Fmsg_targets%2Fmsg_funding_created_target.rs;h=57713196ced38bf5f6cf0f5644435798a73d833d;hb=e0fad3f8a36ccdd9add2a327041d28ddf2ccaecf;hp=ae66f5d35a9ae6c806f91932dc363d5aaafe84eb;hpb=eccd527a55307b94a5c5c5df7e3ef056440e79b8;p=rust-lightning diff --git a/fuzz/fuzz_targets/msg_targets/msg_funding_created_target.rs b/fuzz/fuzz_targets/msg_targets/msg_funding_created_target.rs index ae66f5d3..57713196 100644 --- a/fuzz/fuzz_targets/msg_targets/msg_funding_created_target.rs +++ b/fuzz/fuzz_targets/msg_targets/msg_funding_created_target.rs @@ -1,28 +1,26 @@ +// This file is auto-generated by gen_target.sh based on msg_target_template.txt +// To modify it, modify msg_target_template.txt and run gen_target.sh instead. + extern crate lightning; use lightning::ln::msgs; use lightning::util::reset_rng_state; -use lightning::ln::msgs::{MsgEncodable, MsgDecodable}; - mod utils; -use utils::slice_to_be16; +use utils::VecWriter; #[inline] pub fn do_test(data: &[u8]) { reset_rng_state(); - let mut read_pos = 0; - loop { - test_msg!(msgs::FundingCreated, data, read_pos); - } + test_msg!(msgs::FundingCreated, data); } #[cfg(feature = "afl")] -extern crate afl; +#[macro_use] extern crate afl; #[cfg(feature = "afl")] fn main() { - afl::read_stdio_bytes(|data| { - do_test(&data); + fuzz!(|data| { + do_test(data); }); } @@ -37,13 +35,11 @@ fn main() { } } +extern crate hex; #[cfg(test)] mod tests { - use utils::extend_vec_from_hex; #[test] fn duplicate_crash() { - let mut a = Vec::new(); - extend_vec_from_hex("00", &mut a); - super::do_test(&a); + super::do_test(&::hex::decode("00").unwrap()); } }