From 10e818ac5329a3ff8229e7e76e6c0f7a356678ba Mon Sep 17 00:00:00 2001 From: bmancini55 Date: Thu, 10 Sep 2020 17:52:48 -0400 Subject: [PATCH] Adding fuzzers for gossip_queries messages This commit adds ser/deser fuzzers for five new structs in ln::msgs used for gossip_queries. --- fuzz/src/bin/gen_target.sh | 5 + .../bin/msg_gossip_timestamp_filter_target.rs | 102 ++++++++++++++++++ .../src/bin/msg_query_channel_range_target.rs | 102 ++++++++++++++++++ .../bin/msg_query_short_channel_ids_target.rs | 102 ++++++++++++++++++ .../src/bin/msg_reply_channel_range_target.rs | 102 ++++++++++++++++++ .../msg_reply_short_channel_ids_end_target.rs | 102 ++++++++++++++++++ fuzz/src/msg_targets/gen_target.sh | 5 + fuzz/src/msg_targets/mod.rs | 5 + .../msg_gossip_timestamp_filter.rs | 27 +++++ .../msg_targets/msg_query_channel_range.rs | 27 +++++ .../msg_query_short_channel_ids.rs | 27 +++++ .../msg_targets/msg_reply_channel_range.rs | 27 +++++ .../msg_reply_short_channel_ids_end.rs | 27 +++++ fuzz/targets.h | 5 + 14 files changed, 665 insertions(+) create mode 100644 fuzz/src/bin/msg_gossip_timestamp_filter_target.rs create mode 100644 fuzz/src/bin/msg_query_channel_range_target.rs create mode 100644 fuzz/src/bin/msg_query_short_channel_ids_target.rs create mode 100644 fuzz/src/bin/msg_reply_channel_range_target.rs create mode 100644 fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs create mode 100644 fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs create mode 100644 fuzz/src/msg_targets/msg_query_channel_range.rs create mode 100644 fuzz/src/msg_targets/msg_query_short_channel_ids.rs create mode 100644 fuzz/src/msg_targets/msg_reply_channel_range.rs create mode 100644 fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs diff --git a/fuzz/src/bin/gen_target.sh b/fuzz/src/bin/gen_target.sh index fb1f839a..8cb52f66 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 00000000..1ebd7690 --- /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 00000000..b7e24246 --- /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 00000000..ad18f21e --- /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 00000000..283ac0d4 --- /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 00000000..c8b0e780 --- /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 b9381fc3..044f1a1e 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 8c5dd697..e11e3eb2 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 00000000..73999cd3 --- /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 00000000..bd16147f --- /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 00000000..99cde111 --- /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 00000000..d23b58a2 --- /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 00000000..fcd13154 --- /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 fe94a391..7ca3e93f 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); -- 2.30.2