X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Ffuzz_targets%2Fmsg_targets%2Fmsg_update_add_htlc_target.rs;h=07a0f8196556a6a609018738f26b597577a77617;hb=1b8f4acb275621d52316ae1e5f1059b15f3a120e;hp=674e5bfdca57621d23357a84b78b2e0dc62c38f9;hpb=913ea887fea16be5f272ff8467a0458c086e7ff1;p=rust-lightning diff --git a/fuzz/fuzz_targets/msg_targets/msg_update_add_htlc_target.rs b/fuzz/fuzz_targets/msg_targets/msg_update_add_htlc_target.rs index 674e5bfd..07a0f819 100644 --- a/fuzz/fuzz_targets/msg_targets/msg_update_add_htlc_target.rs +++ b/fuzz/fuzz_targets/msg_targets/msg_update_add_htlc_target.rs @@ -1,3 +1,6 @@ +// 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; @@ -6,23 +9,19 @@ use lightning::util::reset_rng_state; use lightning::ln::msgs::{MsgEncodable, MsgDecodable}; mod utils; -use utils::slice_to_be16; #[inline] pub fn do_test(data: &[u8]) { reset_rng_state(); - let mut read_pos = 0; - loop { - test_msg!(msgs::UpdateAddHTLC, data, read_pos); - } + test_msg!(msgs::UpdateAddHTLC, 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 +36,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()); } }