diff --git a/fuzz/.gitignore b/fuzz/.gitignore new file mode 100644 index 0000000..a092511 --- /dev/null +++ b/fuzz/.gitignore @@ -0,0 +1,3 @@ +target +corpus +artifacts diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000..bc69cac --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "smoltcp-fuzz" +version = "0.0.1" +authors = ["Automatically generated"] +publish = false + +[package.metadata] +cargo-fuzz = true + +[dependencies.smoltcp] +path = ".." + +[dependencies.libfuzzer-sys] +git = "https://github.com/rust-fuzz/libfuzzer-sys.git" + +# Prevent this from interfering with workspaces +[workspace] +members = ["."] + +[[bin]] +name = "packet_parser" +path = "fuzz_targets/packet_parser.rs" diff --git a/fuzz/corpus/packet_parser/arp.bin b/fuzz/corpus/packet_parser/arp.bin new file mode 100644 index 0000000..63dff04 Binary files /dev/null and b/fuzz/corpus/packet_parser/arp.bin differ diff --git a/fuzz/corpus/packet_parser/icmpv4_unreachable.bin b/fuzz/corpus/packet_parser/icmpv4_unreachable.bin new file mode 100644 index 0000000..f98eb86 Binary files /dev/null and b/fuzz/corpus/packet_parser/icmpv4_unreachable.bin differ diff --git a/fuzz/corpus/packet_parser/tcpv4_data.bin b/fuzz/corpus/packet_parser/tcpv4_data.bin new file mode 100644 index 0000000..50fa6f7 Binary files /dev/null and b/fuzz/corpus/packet_parser/tcpv4_data.bin differ diff --git a/fuzz/corpus/packet_parser/tcpv4_fin.bin b/fuzz/corpus/packet_parser/tcpv4_fin.bin new file mode 100644 index 0000000..37713e5 Binary files /dev/null and b/fuzz/corpus/packet_parser/tcpv4_fin.bin differ diff --git a/fuzz/corpus/packet_parser/tcpv4_rst.bin b/fuzz/corpus/packet_parser/tcpv4_rst.bin new file mode 100644 index 0000000..d87d37b Binary files /dev/null and b/fuzz/corpus/packet_parser/tcpv4_rst.bin differ diff --git a/fuzz/corpus/packet_parser/tcpv4_syn.bin b/fuzz/corpus/packet_parser/tcpv4_syn.bin new file mode 100644 index 0000000..1353aae Binary files /dev/null and b/fuzz/corpus/packet_parser/tcpv4_syn.bin differ diff --git a/fuzz/corpus/packet_parser/udpv4.bin b/fuzz/corpus/packet_parser/udpv4.bin new file mode 100644 index 0000000..f04369b Binary files /dev/null and b/fuzz/corpus/packet_parser/udpv4.bin differ diff --git a/fuzz/fuzz_targets/packet_parser.rs b/fuzz/fuzz_targets/packet_parser.rs new file mode 100644 index 0000000..357e1f3 --- /dev/null +++ b/fuzz/fuzz_targets/packet_parser.rs @@ -0,0 +1,8 @@ +#![no_main] +#[macro_use] extern crate libfuzzer_sys; +extern crate smoltcp; + +fuzz_target!(|data: &[u8]| { + use smoltcp::wire::*; + format!("{}", PrettyPrinter::>::new("", &data)); +});