Skip to content

Commit 6271dc7

Browse files
committed
Add packet parser fuzzer.
1 parent 735def7 commit 6271dc7

File tree

10 files changed

+33
-0
lines changed

10 files changed

+33
-0
lines changed

fuzz/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target
2+
corpus
3+
artifacts

fuzz/Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "smoltcp-fuzz"
3+
version = "0.0.1"
4+
authors = ["Automatically generated"]
5+
publish = false
6+
7+
[package.metadata]
8+
cargo-fuzz = true
9+
10+
[dependencies.smoltcp]
11+
path = ".."
12+
13+
[dependencies.libfuzzer-sys]
14+
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
15+
16+
# Prevent this from interfering with workspaces
17+
[workspace]
18+
members = ["."]
19+
20+
[[bin]]
21+
name = "packet_parser"
22+
path = "fuzz_targets/packet_parser.rs"

fuzz/corpus/packet_parser/arp.bin

60 Bytes
Binary file not shown.
590 Bytes
Binary file not shown.
166 Bytes
Binary file not shown.
54 Bytes
Binary file not shown.
54 Bytes
Binary file not shown.
74 Bytes
Binary file not shown.

fuzz/corpus/packet_parser/udpv4.bin

122 Bytes
Binary file not shown.

fuzz/fuzz_targets/packet_parser.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![no_main]
2+
#[macro_use] extern crate libfuzzer_sys;
3+
extern crate smoltcp;
4+
5+
fuzz_target!(|data: &[u8]| {
6+
use smoltcp::wire::*;
7+
format!("{}", PrettyPrinter::<EthernetFrame<&'static [u8]>>::new("", &data));
8+
});

0 commit comments

Comments
 (0)