1 // This file is auto-generated by gen_target.sh based on msg_target_template.txt
2 // To modify it, modify msg_target_template.txt and run gen_target.sh instead.
4 extern crate lightning;
6 use lightning::util::reset_rng_state;
8 use lightning::ln::msgs::{MsgEncodable, MsgDecodable, Ping};
11 pub fn do_test(data: &[u8]) {
13 if let Ok(msg) = Ping::decode(data) {
18 #[cfg(feature = "afl")]
20 #[cfg(feature = "afl")]
22 afl::read_stdio_bytes(|data| {
27 #[cfg(feature = "honggfuzz")]
28 #[macro_use] extern crate honggfuzz;
29 #[cfg(feature = "honggfuzz")]
40 fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
42 for (idx, c) in hex.as_bytes().iter().enumerate() {
45 b'A'...b'F' => b |= c - b'A' + 10,
46 b'a'...b'f' => b |= c - b'a' + 10,
47 b'0'...b'9' => b |= c - b'0',
48 _ => panic!("Bad hex"),
58 fn duplicate_crash() {
59 let mut a = Vec::new();
60 extend_vec_from_hex("00", &mut a);