Skip to content

Commit 999f973

Browse files
committed
Add Fuzzing
1 parent 7cad036 commit 999f973

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

fuzz/.gitignore

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

fuzz/Cargo.lock

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzz/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
authors = ["Xavier Lau <[email protected]>"]
3+
edition = "2021"
4+
metadata = { cargo-fuzz = true }
5+
name = "array-bytes-fuzz"
6+
publish = false
7+
version = "4.0.0"
8+
9+
[dependencies]
10+
array-bytes = { path = ".." }
11+
libfuzzer-sys = "0.4"
12+
13+
[workspace]
14+
members = ["."]
15+
16+
[[bin]]
17+
doc = false
18+
name = "bytes-hex-conversion"
19+
path = "fuzz_targets/bytes_hex_conversion.rs"
20+
test = false
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![no_main]
2+
3+
libfuzzer_sys::fuzz_target!(|data: &[u8]| {
4+
let _ = array_bytes::bytes2hex("", data);
5+
let _ = array_bytes::hex_bytes2hex_str(data);
6+
let _ = array_bytes::hex2bytes(&String::from_utf8_lossy(data));
7+
});

0 commit comments

Comments
 (0)