2019-12-11 13:18:43 -05:00
|
|
|
// 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.
|
|
|
|
|
2020-01-19 15:38:34 -05:00
|
|
|
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
|
2019-12-11 13:18:43 -05:00
|
|
|
|
|
|
|
extern crate lightning_fuzz;
|
|
|
|
use lightning_fuzz::msg_targets::msg_funding_signed::*;
|
|
|
|
|
2020-01-19 15:38:34 -05:00
|
|
|
use std::fs;
|
2019-12-11 13:18:43 -05:00
|
|
|
use std::io::Read;
|
|
|
|
|
|
|
|
#[cfg(feature = "afl")]
|
|
|
|
#[macro_use] extern crate afl;
|
|
|
|
#[cfg(feature = "afl")]
|
|
|
|
fn main() {
|
|
|
|
fuzz!(|data| {
|
|
|
|
msg_funding_signed_run(data.as_ptr(), data.len());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
|
|
#[macro_use] extern crate honggfuzz;
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
|
|
fn main() {
|
|
|
|
loop {
|
|
|
|
fuzz!(|data| {
|
|
|
|
msg_funding_signed_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_funding_signed_run(data.as_ptr(), data.len());
|
|
|
|
});
|
|
|
|
|
|
|
|
#[cfg(feature = "stdin_fuzz")]
|
|
|
|
fn main() {
|
|
|
|
let mut data = Vec::with_capacity(8192);
|
|
|
|
std::io::stdin().read_to_end(&mut data).unwrap();
|
|
|
|
msg_funding_signed_run(data.as_ptr(), data.len());
|
|
|
|
}
|
2020-01-19 15:38:34 -05:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn run_test_cases() {
|
|
|
|
let mut data: Vec<u8> = vec![0];
|
|
|
|
msg_funding_signed_run(data.as_ptr(), data.len());
|
|
|
|
if let Ok(tests) = fs::read_dir("test_cases/msg_funding_signed") {
|
|
|
|
for test in tests {
|
|
|
|
data.clear();
|
|
|
|
let path = test.unwrap().path();
|
|
|
|
println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
|
|
|
|
fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
|
|
|
|
msg_funding_signed_run(data.as_ptr(), data.len());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|