Skip to content

Commit

Permalink
Add packet parser fuzzer.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jun 24, 2017
1 parent 735def7 commit 6271dc7
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
corpus
artifacts
22 changes: 22 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Binary file added fuzz/corpus/packet_parser/arp.bin
Binary file not shown.
Binary file added fuzz/corpus/packet_parser/icmpv4_unreachable.bin
Binary file not shown.
Binary file added fuzz/corpus/packet_parser/tcpv4_data.bin
Binary file not shown.
Binary file added fuzz/corpus/packet_parser/tcpv4_fin.bin
Binary file not shown.
Binary file added fuzz/corpus/packet_parser/tcpv4_rst.bin
Binary file not shown.
Binary file added fuzz/corpus/packet_parser/tcpv4_syn.bin
Binary file not shown.
Binary file added fuzz/corpus/packet_parser/udpv4.bin
Binary file not shown.
8 changes: 8 additions & 0 deletions fuzz/fuzz_targets/packet_parser.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate smoltcp;

fuzz_target!(|data: &[u8]| {
use smoltcp::wire::*;
format!("{}", PrettyPrinter::<EthernetFrame<&'static [u8]>>::new("", &data));
});

0 comments on commit 6271dc7

Please sign in to comment.