2018-05-13 13:22:56 -04:00
|
|
|
// 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.
|
|
|
|
|
2018-05-13 05:09:46 +09:00
|
|
|
extern crate lightning;
|
|
|
|
|
|
|
|
use lightning::ln::msgs;
|
|
|
|
use lightning::util::reset_rng_state;
|
|
|
|
|
|
|
|
use lightning::ln::msgs::{MsgEncodable, MsgDecodable};
|
|
|
|
|
|
|
|
mod utils;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn do_test(data: &[u8]) {
|
|
|
|
reset_rng_state();
|
2018-08-29 15:56:48 -04:00
|
|
|
TEST_MSG!(msgs::MSG_TARGET, dataEXTRA_ARGS);
|
2018-05-13 05:09:46 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "afl")]
|
2018-08-16 14:20:34 -04:00
|
|
|
#[macro_use] extern crate afl;
|
2018-05-13 05:09:46 +09:00
|
|
|
#[cfg(feature = "afl")]
|
|
|
|
fn main() {
|
2018-08-16 14:20:34 -04:00
|
|
|
fuzz!(|data| {
|
|
|
|
do_test(data);
|
2018-05-13 05:09:46 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
|
|
#[macro_use] extern crate honggfuzz;
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
|
|
fn main() {
|
|
|
|
loop {
|
|
|
|
fuzz!(|data| {
|
|
|
|
do_test(data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-28 09:44:15 -07:00
|
|
|
extern crate hex;
|
2018-05-13 05:09:46 +09:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
#[test]
|
|
|
|
fn duplicate_crash() {
|
2018-07-28 09:44:15 -07:00
|
|
|
super::do_test(&::hex::decode("00").unwrap());
|
2018-05-13 05:09:46 +09:00
|
|
|
}
|
|
|
|
}
|