mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-15 15:39:09 +01:00
Adding fuzzers for gossip_queries messages
This commit adds ser/deser fuzzers for five new structs in ln::msgs used for gossip_queries.
This commit is contained in:
parent
5ba4560be9
commit
10e818ac53
14 changed files with 665 additions and 0 deletions
|
@ -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::
|
||||
|
|
102
fuzz/src/bin/msg_gossip_timestamp_filter_target.rs
Normal file
102
fuzz/src/bin/msg_gossip_timestamp_filter_target.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<u8> = 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<u8> = 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!();
|
||||
}
|
||||
}
|
||||
}
|
102
fuzz/src/bin/msg_query_channel_range_target.rs
Normal file
102
fuzz/src/bin/msg_query_channel_range_target.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<u8> = 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<u8> = 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!();
|
||||
}
|
||||
}
|
||||
}
|
102
fuzz/src/bin/msg_query_short_channel_ids_target.rs
Normal file
102
fuzz/src/bin/msg_query_short_channel_ids_target.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<u8> = 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<u8> = 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!();
|
||||
}
|
||||
}
|
||||
}
|
102
fuzz/src/bin/msg_reply_channel_range_target.rs
Normal file
102
fuzz/src/bin/msg_reply_channel_range_target.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<u8> = 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<u8> = 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!();
|
||||
}
|
||||
}
|
||||
}
|
102
fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs
Normal file
102
fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<u8> = 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<u8> = 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!();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
27
fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs
Normal file
27
fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Out: test_logger::Output>(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);
|
||||
}
|
27
fuzz/src/msg_targets/msg_query_channel_range.rs
Normal file
27
fuzz/src/msg_targets/msg_query_channel_range.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Out: test_logger::Output>(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);
|
||||
}
|
27
fuzz/src/msg_targets/msg_query_short_channel_ids.rs
Normal file
27
fuzz/src/msg_targets/msg_query_short_channel_ids.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Out: test_logger::Output>(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);
|
||||
}
|
27
fuzz/src/msg_targets/msg_reply_channel_range.rs
Normal file
27
fuzz/src/msg_targets/msg_reply_channel_range.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Out: test_logger::Output>(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);
|
||||
}
|
27
fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs
Normal file
27
fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs
Normal file
|
@ -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 <LICENSE-APACHE
|
||||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Out: test_logger::Output>(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);
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue