mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
45 lines
846 B
Rust
45 lines
846 B
Rust
// 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.
|
|
|
|
extern crate lightning;
|
|
|
|
use lightning::util::reset_rng_state;
|
|
|
|
use lightning::ln::msgs::{MsgEncodable, MsgDecodable, Pong};
|
|
|
|
#[inline]
|
|
pub fn do_test(data: &[u8]) {
|
|
reset_rng_state();
|
|
if let Ok(msg) = Pong::decode(data) {
|
|
let _ = msg.encode();
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "afl")]
|
|
extern crate afl;
|
|
#[cfg(feature = "afl")]
|
|
fn main() {
|
|
afl::read_stdio_bytes(|data| {
|
|
do_test(&data);
|
|
});
|
|
}
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
#[macro_use] extern crate honggfuzz;
|
|
#[cfg(feature = "honggfuzz")]
|
|
fn main() {
|
|
loop {
|
|
fuzz!(|data| {
|
|
do_test(data);
|
|
});
|
|
}
|
|
}
|
|
|
|
extern crate hex;
|
|
#[cfg(test)]
|
|
mod tests {
|
|
#[test]
|
|
fn duplicate_crash() {
|
|
super::do_test(&::hex::decode("00").unwrap());
|
|
}
|
|
}
|