From: bmancini55 Date: Thu, 10 Sep 2020 21:52:48 +0000 (-0400) Subject: Adding fuzzers for gossip_queries messages X-Git-Tag: v0.0.12~27^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=10e818ac5329a3ff8229e7e76e6c0f7a356678ba;p=rust-lightning Adding fuzzers for gossip_queries messages This commit adds ser/deser fuzzers for five new structs in ln::msgs used for gossip_queries. --- diff --git a/fuzz/src/bin/gen_target.sh b/fuzz/src/bin/gen_target.sh index fb1f839a5..8cb52f668 100755 --- a/fuzz/src/bin/gen_target.sh +++ b/fuzz/src/bin/gen_target.sh @@ -32,6 +32,11 @@ GEN_TEST msg_update_fulfill_htlc msg_targets:: GEN_TEST msg_channel_announcement msg_targets:: GEN_TEST msg_node_announcement msg_targets:: +GEN_TEST msg_query_short_channel_ids msg_targets:: +GEN_TEST msg_reply_short_channel_ids_end msg_targets:: +GEN_TEST msg_query_channel_range msg_targets:: +GEN_TEST msg_reply_channel_range msg_targets:: +GEN_TEST msg_gossip_timestamp_filter msg_targets:: GEN_TEST msg_update_add_htlc msg_targets:: GEN_TEST msg_error_message msg_targets:: diff --git a/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs b/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs new file mode 100644 index 000000000..1ebd76903 --- /dev/null +++ b/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs @@ -0,0 +1,102 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// This file is auto-generated by gen_target.sh based on target_template.txt +// To modify it, modify target_template.txt and run gen_target.sh instead. + +#![cfg_attr(feature = "libfuzzer_fuzz", no_main)] + +extern crate lightning_fuzz; +use lightning_fuzz::msg_targets::msg_gossip_timestamp_filter::*; + +#[cfg(feature = "afl")] +#[macro_use] extern crate afl; +#[cfg(feature = "afl")] +fn main() { + fuzz!(|data| { + msg_gossip_timestamp_filter_run(data.as_ptr(), data.len()); + }); +} + +#[cfg(feature = "honggfuzz")] +#[macro_use] extern crate honggfuzz; +#[cfg(feature = "honggfuzz")] +fn main() { + loop { + fuzz!(|data| { + msg_gossip_timestamp_filter_run(data.as_ptr(), data.len()); + }); + } +} + +#[cfg(feature = "libfuzzer_fuzz")] +#[macro_use] extern crate libfuzzer_sys; +#[cfg(feature = "libfuzzer_fuzz")] +fuzz_target!(|data: &[u8]| { + msg_gossip_timestamp_filter_run(data.as_ptr(), data.len()); +}); + +#[cfg(feature = "stdin_fuzz")] +fn main() { + use std::io::Read; + + let mut data = Vec::with_capacity(8192); + std::io::stdin().read_to_end(&mut data).unwrap(); + msg_gossip_timestamp_filter_run(data.as_ptr(), data.len()); +} + +#[test] +fn run_test_cases() { + use std::fs; + use std::io::Read; + use lightning_fuzz::utils::test_logger::StringBuffer; + + use std::sync::{atomic, Arc}; + { + let data: Vec = vec![0]; + msg_gossip_timestamp_filter_run(data.as_ptr(), data.len()); + } + let mut threads = Vec::new(); + let threads_running = Arc::new(atomic::AtomicUsize::new(0)); + if let Ok(tests) = fs::read_dir("test_cases/msg_gossip_timestamp_filter") { + for test in tests { + let mut data: Vec = Vec::new(); + let path = test.unwrap().path(); + fs::File::open(&path).unwrap().read_to_end(&mut data).unwrap(); + threads_running.fetch_add(1, atomic::Ordering::AcqRel); + + let thread_count_ref = Arc::clone(&threads_running); + let main_thread_ref = std::thread::current(); + threads.push((path.file_name().unwrap().to_str().unwrap().to_string(), + std::thread::spawn(move || { + let string_logger = StringBuffer::new(); + + let panic_logger = string_logger.clone(); + let res = if ::std::panic::catch_unwind(move || { + msg_gossip_timestamp_filter_test(&data, panic_logger); + }).is_err() { + Some(string_logger.into_string()) + } else { None }; + thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel); + main_thread_ref.unpark(); + res + }) + )); + while threads_running.load(atomic::Ordering::Acquire) > 32 { + std::thread::park(); + } + } + } + for (test, thread) in threads.drain(..) { + if let Some(output) = thread.join().unwrap() { + println!("Output of {}:\n{}", test, output); + panic!(); + } + } +} diff --git a/fuzz/src/bin/msg_query_channel_range_target.rs b/fuzz/src/bin/msg_query_channel_range_target.rs new file mode 100644 index 000000000..b7e242467 --- /dev/null +++ b/fuzz/src/bin/msg_query_channel_range_target.rs @@ -0,0 +1,102 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// This file is auto-generated by gen_target.sh based on target_template.txt +// To modify it, modify target_template.txt and run gen_target.sh instead. + +#![cfg_attr(feature = "libfuzzer_fuzz", no_main)] + +extern crate lightning_fuzz; +use lightning_fuzz::msg_targets::msg_query_channel_range::*; + +#[cfg(feature = "afl")] +#[macro_use] extern crate afl; +#[cfg(feature = "afl")] +fn main() { + fuzz!(|data| { + msg_query_channel_range_run(data.as_ptr(), data.len()); + }); +} + +#[cfg(feature = "honggfuzz")] +#[macro_use] extern crate honggfuzz; +#[cfg(feature = "honggfuzz")] +fn main() { + loop { + fuzz!(|data| { + msg_query_channel_range_run(data.as_ptr(), data.len()); + }); + } +} + +#[cfg(feature = "libfuzzer_fuzz")] +#[macro_use] extern crate libfuzzer_sys; +#[cfg(feature = "libfuzzer_fuzz")] +fuzz_target!(|data: &[u8]| { + msg_query_channel_range_run(data.as_ptr(), data.len()); +}); + +#[cfg(feature = "stdin_fuzz")] +fn main() { + use std::io::Read; + + let mut data = Vec::with_capacity(8192); + std::io::stdin().read_to_end(&mut data).unwrap(); + msg_query_channel_range_run(data.as_ptr(), data.len()); +} + +#[test] +fn run_test_cases() { + use std::fs; + use std::io::Read; + use lightning_fuzz::utils::test_logger::StringBuffer; + + use std::sync::{atomic, Arc}; + { + let data: Vec = vec![0]; + msg_query_channel_range_run(data.as_ptr(), data.len()); + } + let mut threads = Vec::new(); + let threads_running = Arc::new(atomic::AtomicUsize::new(0)); + if let Ok(tests) = fs::read_dir("test_cases/msg_query_channel_range") { + for test in tests { + let mut data: Vec = Vec::new(); + let path = test.unwrap().path(); + fs::File::open(&path).unwrap().read_to_end(&mut data).unwrap(); + threads_running.fetch_add(1, atomic::Ordering::AcqRel); + + let thread_count_ref = Arc::clone(&threads_running); + let main_thread_ref = std::thread::current(); + threads.push((path.file_name().unwrap().to_str().unwrap().to_string(), + std::thread::spawn(move || { + let string_logger = StringBuffer::new(); + + let panic_logger = string_logger.clone(); + let res = if ::std::panic::catch_unwind(move || { + msg_query_channel_range_test(&data, panic_logger); + }).is_err() { + Some(string_logger.into_string()) + } else { None }; + thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel); + main_thread_ref.unpark(); + res + }) + )); + while threads_running.load(atomic::Ordering::Acquire) > 32 { + std::thread::park(); + } + } + } + for (test, thread) in threads.drain(..) { + if let Some(output) = thread.join().unwrap() { + println!("Output of {}:\n{}", test, output); + panic!(); + } + } +} diff --git a/fuzz/src/bin/msg_query_short_channel_ids_target.rs b/fuzz/src/bin/msg_query_short_channel_ids_target.rs new file mode 100644 index 000000000..ad18f21e2 --- /dev/null +++ b/fuzz/src/bin/msg_query_short_channel_ids_target.rs @@ -0,0 +1,102 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// This file is auto-generated by gen_target.sh based on target_template.txt +// To modify it, modify target_template.txt and run gen_target.sh instead. + +#![cfg_attr(feature = "libfuzzer_fuzz", no_main)] + +extern crate lightning_fuzz; +use lightning_fuzz::msg_targets::msg_query_short_channel_ids::*; + +#[cfg(feature = "afl")] +#[macro_use] extern crate afl; +#[cfg(feature = "afl")] +fn main() { + fuzz!(|data| { + msg_query_short_channel_ids_run(data.as_ptr(), data.len()); + }); +} + +#[cfg(feature = "honggfuzz")] +#[macro_use] extern crate honggfuzz; +#[cfg(feature = "honggfuzz")] +fn main() { + loop { + fuzz!(|data| { + msg_query_short_channel_ids_run(data.as_ptr(), data.len()); + }); + } +} + +#[cfg(feature = "libfuzzer_fuzz")] +#[macro_use] extern crate libfuzzer_sys; +#[cfg(feature = "libfuzzer_fuzz")] +fuzz_target!(|data: &[u8]| { + msg_query_short_channel_ids_run(data.as_ptr(), data.len()); +}); + +#[cfg(feature = "stdin_fuzz")] +fn main() { + use std::io::Read; + + let mut data = Vec::with_capacity(8192); + std::io::stdin().read_to_end(&mut data).unwrap(); + msg_query_short_channel_ids_run(data.as_ptr(), data.len()); +} + +#[test] +fn run_test_cases() { + use std::fs; + use std::io::Read; + use lightning_fuzz::utils::test_logger::StringBuffer; + + use std::sync::{atomic, Arc}; + { + let data: Vec = vec![0]; + msg_query_short_channel_ids_run(data.as_ptr(), data.len()); + } + let mut threads = Vec::new(); + let threads_running = Arc::new(atomic::AtomicUsize::new(0)); + if let Ok(tests) = fs::read_dir("test_cases/msg_query_short_channel_ids") { + for test in tests { + let mut data: Vec = Vec::new(); + let path = test.unwrap().path(); + fs::File::open(&path).unwrap().read_to_end(&mut data).unwrap(); + threads_running.fetch_add(1, atomic::Ordering::AcqRel); + + let thread_count_ref = Arc::clone(&threads_running); + let main_thread_ref = std::thread::current(); + threads.push((path.file_name().unwrap().to_str().unwrap().to_string(), + std::thread::spawn(move || { + let string_logger = StringBuffer::new(); + + let panic_logger = string_logger.clone(); + let res = if ::std::panic::catch_unwind(move || { + msg_query_short_channel_ids_test(&data, panic_logger); + }).is_err() { + Some(string_logger.into_string()) + } else { None }; + thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel); + main_thread_ref.unpark(); + res + }) + )); + while threads_running.load(atomic::Ordering::Acquire) > 32 { + std::thread::park(); + } + } + } + for (test, thread) in threads.drain(..) { + if let Some(output) = thread.join().unwrap() { + println!("Output of {}:\n{}", test, output); + panic!(); + } + } +} diff --git a/fuzz/src/bin/msg_reply_channel_range_target.rs b/fuzz/src/bin/msg_reply_channel_range_target.rs new file mode 100644 index 000000000..283ac0d46 --- /dev/null +++ b/fuzz/src/bin/msg_reply_channel_range_target.rs @@ -0,0 +1,102 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// This file is auto-generated by gen_target.sh based on target_template.txt +// To modify it, modify target_template.txt and run gen_target.sh instead. + +#![cfg_attr(feature = "libfuzzer_fuzz", no_main)] + +extern crate lightning_fuzz; +use lightning_fuzz::msg_targets::msg_reply_channel_range::*; + +#[cfg(feature = "afl")] +#[macro_use] extern crate afl; +#[cfg(feature = "afl")] +fn main() { + fuzz!(|data| { + msg_reply_channel_range_run(data.as_ptr(), data.len()); + }); +} + +#[cfg(feature = "honggfuzz")] +#[macro_use] extern crate honggfuzz; +#[cfg(feature = "honggfuzz")] +fn main() { + loop { + fuzz!(|data| { + msg_reply_channel_range_run(data.as_ptr(), data.len()); + }); + } +} + +#[cfg(feature = "libfuzzer_fuzz")] +#[macro_use] extern crate libfuzzer_sys; +#[cfg(feature = "libfuzzer_fuzz")] +fuzz_target!(|data: &[u8]| { + msg_reply_channel_range_run(data.as_ptr(), data.len()); +}); + +#[cfg(feature = "stdin_fuzz")] +fn main() { + use std::io::Read; + + let mut data = Vec::with_capacity(8192); + std::io::stdin().read_to_end(&mut data).unwrap(); + msg_reply_channel_range_run(data.as_ptr(), data.len()); +} + +#[test] +fn run_test_cases() { + use std::fs; + use std::io::Read; + use lightning_fuzz::utils::test_logger::StringBuffer; + + use std::sync::{atomic, Arc}; + { + let data: Vec = vec![0]; + msg_reply_channel_range_run(data.as_ptr(), data.len()); + } + let mut threads = Vec::new(); + let threads_running = Arc::new(atomic::AtomicUsize::new(0)); + if let Ok(tests) = fs::read_dir("test_cases/msg_reply_channel_range") { + for test in tests { + let mut data: Vec = Vec::new(); + let path = test.unwrap().path(); + fs::File::open(&path).unwrap().read_to_end(&mut data).unwrap(); + threads_running.fetch_add(1, atomic::Ordering::AcqRel); + + let thread_count_ref = Arc::clone(&threads_running); + let main_thread_ref = std::thread::current(); + threads.push((path.file_name().unwrap().to_str().unwrap().to_string(), + std::thread::spawn(move || { + let string_logger = StringBuffer::new(); + + let panic_logger = string_logger.clone(); + let res = if ::std::panic::catch_unwind(move || { + msg_reply_channel_range_test(&data, panic_logger); + }).is_err() { + Some(string_logger.into_string()) + } else { None }; + thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel); + main_thread_ref.unpark(); + res + }) + )); + while threads_running.load(atomic::Ordering::Acquire) > 32 { + std::thread::park(); + } + } + } + for (test, thread) in threads.drain(..) { + if let Some(output) = thread.join().unwrap() { + println!("Output of {}:\n{}", test, output); + panic!(); + } + } +} diff --git a/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs b/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs new file mode 100644 index 000000000..c8b0e7804 --- /dev/null +++ b/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs @@ -0,0 +1,102 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// This file is auto-generated by gen_target.sh based on target_template.txt +// To modify it, modify target_template.txt and run gen_target.sh instead. + +#![cfg_attr(feature = "libfuzzer_fuzz", no_main)] + +extern crate lightning_fuzz; +use lightning_fuzz::msg_targets::msg_reply_short_channel_ids_end::*; + +#[cfg(feature = "afl")] +#[macro_use] extern crate afl; +#[cfg(feature = "afl")] +fn main() { + fuzz!(|data| { + msg_reply_short_channel_ids_end_run(data.as_ptr(), data.len()); + }); +} + +#[cfg(feature = "honggfuzz")] +#[macro_use] extern crate honggfuzz; +#[cfg(feature = "honggfuzz")] +fn main() { + loop { + fuzz!(|data| { + msg_reply_short_channel_ids_end_run(data.as_ptr(), data.len()); + }); + } +} + +#[cfg(feature = "libfuzzer_fuzz")] +#[macro_use] extern crate libfuzzer_sys; +#[cfg(feature = "libfuzzer_fuzz")] +fuzz_target!(|data: &[u8]| { + msg_reply_short_channel_ids_end_run(data.as_ptr(), data.len()); +}); + +#[cfg(feature = "stdin_fuzz")] +fn main() { + use std::io::Read; + + let mut data = Vec::with_capacity(8192); + std::io::stdin().read_to_end(&mut data).unwrap(); + msg_reply_short_channel_ids_end_run(data.as_ptr(), data.len()); +} + +#[test] +fn run_test_cases() { + use std::fs; + use std::io::Read; + use lightning_fuzz::utils::test_logger::StringBuffer; + + use std::sync::{atomic, Arc}; + { + let data: Vec = vec![0]; + msg_reply_short_channel_ids_end_run(data.as_ptr(), data.len()); + } + let mut threads = Vec::new(); + let threads_running = Arc::new(atomic::AtomicUsize::new(0)); + if let Ok(tests) = fs::read_dir("test_cases/msg_reply_short_channel_ids_end") { + for test in tests { + let mut data: Vec = Vec::new(); + let path = test.unwrap().path(); + fs::File::open(&path).unwrap().read_to_end(&mut data).unwrap(); + threads_running.fetch_add(1, atomic::Ordering::AcqRel); + + let thread_count_ref = Arc::clone(&threads_running); + let main_thread_ref = std::thread::current(); + threads.push((path.file_name().unwrap().to_str().unwrap().to_string(), + std::thread::spawn(move || { + let string_logger = StringBuffer::new(); + + let panic_logger = string_logger.clone(); + let res = if ::std::panic::catch_unwind(move || { + msg_reply_short_channel_ids_end_test(&data, panic_logger); + }).is_err() { + Some(string_logger.into_string()) + } else { None }; + thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel); + main_thread_ref.unpark(); + res + }) + )); + while threads_running.load(atomic::Ordering::Acquire) > 32 { + std::thread::park(); + } + } + } + for (test, thread) in threads.drain(..) { + if let Some(output) = thread.join().unwrap() { + println!("Output of {}:\n{}", test, output); + panic!(); + } + } +} diff --git a/fuzz/src/msg_targets/gen_target.sh b/fuzz/src/msg_targets/gen_target.sh index b9381fc3a..044f1a1ef 100755 --- a/fuzz/src/msg_targets/gen_target.sh +++ b/fuzz/src/msg_targets/gen_target.sh @@ -30,6 +30,11 @@ GEN_TEST UpdateFulfillHTLC test_msg "" GEN_TEST ChannelAnnouncement test_msg_exact "" GEN_TEST NodeAnnouncement test_msg_exact "" +GEN_TEST QueryShortChannelIds test_msg "" +GEN_TEST ReplyShortChannelIdsEnd test_msg "" +GEN_TEST QueryChannelRange test_msg "" +GEN_TEST ReplyChannelRange test_msg "" +GEN_TEST GossipTimestampFilter test_msg "" GEN_TEST UpdateAddHTLC test_msg_hole ", 85, 33" GEN_TEST ErrorMessage test_msg_hole ", 32, 2" diff --git a/fuzz/src/msg_targets/mod.rs b/fuzz/src/msg_targets/mod.rs index 8c5dd6971..e11e3eb26 100644 --- a/fuzz/src/msg_targets/mod.rs +++ b/fuzz/src/msg_targets/mod.rs @@ -17,6 +17,11 @@ pub mod msg_update_fee; pub mod msg_update_fulfill_htlc; pub mod msg_channel_announcement; pub mod msg_node_announcement; +pub mod msg_query_short_channel_ids; +pub mod msg_reply_short_channel_ids_end; +pub mod msg_query_channel_range; +pub mod msg_reply_channel_range; +pub mod msg_gossip_timestamp_filter; pub mod msg_update_add_htlc; pub mod msg_error_message; pub mod msg_channel_update; diff --git a/fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs b/fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs new file mode 100644 index 000000000..73999cd3a --- /dev/null +++ b/fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs @@ -0,0 +1,27 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// 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. + +use lightning::ln::msgs; + +use msg_targets::utils::VecWriter; +use utils::test_logger; + +#[inline] +pub fn msg_gossip_timestamp_filter_test(data: &[u8], _out: Out) { + test_msg!(msgs::GossipTimestampFilter, data); +} + +#[no_mangle] +pub extern "C" fn msg_gossip_timestamp_filter_run(data: *const u8, datalen: usize) { + let data = unsafe { std::slice::from_raw_parts(data, datalen) }; + test_msg!(msgs::GossipTimestampFilter, data); +} diff --git a/fuzz/src/msg_targets/msg_query_channel_range.rs b/fuzz/src/msg_targets/msg_query_channel_range.rs new file mode 100644 index 000000000..bd16147f6 --- /dev/null +++ b/fuzz/src/msg_targets/msg_query_channel_range.rs @@ -0,0 +1,27 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// 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. + +use lightning::ln::msgs; + +use msg_targets::utils::VecWriter; +use utils::test_logger; + +#[inline] +pub fn msg_query_channel_range_test(data: &[u8], _out: Out) { + test_msg!(msgs::QueryChannelRange, data); +} + +#[no_mangle] +pub extern "C" fn msg_query_channel_range_run(data: *const u8, datalen: usize) { + let data = unsafe { std::slice::from_raw_parts(data, datalen) }; + test_msg!(msgs::QueryChannelRange, data); +} diff --git a/fuzz/src/msg_targets/msg_query_short_channel_ids.rs b/fuzz/src/msg_targets/msg_query_short_channel_ids.rs new file mode 100644 index 000000000..99cde1117 --- /dev/null +++ b/fuzz/src/msg_targets/msg_query_short_channel_ids.rs @@ -0,0 +1,27 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// 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. + +use lightning::ln::msgs; + +use msg_targets::utils::VecWriter; +use utils::test_logger; + +#[inline] +pub fn msg_query_short_channel_ids_test(data: &[u8], _out: Out) { + test_msg!(msgs::QueryShortChannelIds, data); +} + +#[no_mangle] +pub extern "C" fn msg_query_short_channel_ids_run(data: *const u8, datalen: usize) { + let data = unsafe { std::slice::from_raw_parts(data, datalen) }; + test_msg!(msgs::QueryShortChannelIds, data); +} diff --git a/fuzz/src/msg_targets/msg_reply_channel_range.rs b/fuzz/src/msg_targets/msg_reply_channel_range.rs new file mode 100644 index 000000000..d23b58a2d --- /dev/null +++ b/fuzz/src/msg_targets/msg_reply_channel_range.rs @@ -0,0 +1,27 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// 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. + +use lightning::ln::msgs; + +use msg_targets::utils::VecWriter; +use utils::test_logger; + +#[inline] +pub fn msg_reply_channel_range_test(data: &[u8], _out: Out) { + test_msg!(msgs::ReplyChannelRange, data); +} + +#[no_mangle] +pub extern "C" fn msg_reply_channel_range_run(data: *const u8, datalen: usize) { + let data = unsafe { std::slice::from_raw_parts(data, datalen) }; + test_msg!(msgs::ReplyChannelRange, data); +} diff --git a/fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs b/fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs new file mode 100644 index 000000000..fcd131543 --- /dev/null +++ b/fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs @@ -0,0 +1,27 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +// 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. + +use lightning::ln::msgs; + +use msg_targets::utils::VecWriter; +use utils::test_logger; + +#[inline] +pub fn msg_reply_short_channel_ids_end_test(data: &[u8], _out: Out) { + test_msg!(msgs::ReplyShortChannelIdsEnd, data); +} + +#[no_mangle] +pub extern "C" fn msg_reply_short_channel_ids_end_run(data: *const u8, datalen: usize) { + let data = unsafe { std::slice::from_raw_parts(data, datalen) }; + test_msg!(msgs::ReplyShortChannelIdsEnd, data); +} diff --git a/fuzz/targets.h b/fuzz/targets.h index fe94a3913..7ca3e93f3 100644 --- a/fuzz/targets.h +++ b/fuzz/targets.h @@ -23,6 +23,11 @@ void msg_update_fee_run(const unsigned char* data, size_t data_len); void msg_update_fulfill_htlc_run(const unsigned char* data, size_t data_len); void msg_channel_announcement_run(const unsigned char* data, size_t data_len); void msg_node_announcement_run(const unsigned char* data, size_t data_len); +void msg_query_short_channel_ids_run(const unsigned char* data, size_t data_len); +void msg_reply_short_channel_ids_end_run(const unsigned char* data, size_t data_len); +void msg_query_channel_range_run(const unsigned char* data, size_t data_len); +void msg_reply_channel_range_run(const unsigned char* data, size_t data_len); +void msg_gossip_timestamp_filter_run(const unsigned char* data, size_t data_len); void msg_update_add_htlc_run(const unsigned char* data, size_t data_len); void msg_error_message_run(const unsigned char* data, size_t data_len); void msg_channel_update_run(const unsigned char* data, size_t data_len);