Skip to content

Commit 98d9149

Browse files
committed
Introduce the cargo-fuzz setup that found the chunker crash
This is only lightly edited from the setup that discovered the bug I fixed in xt v0.19.4. All I did was specify the libfuzzer-sys version more explicitly, sort the formats alphabetically, and rename the target from fuzz_target_1 to something better. I'm also going to set up a fuzz target specific to reader inputs.
1 parent 6858253 commit 98d9149

File tree

4 files changed

+357
-0
lines changed

4 files changed

+357
-0
lines changed

fuzz/.gitignore

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

fuzz/Cargo.lock

Lines changed: 318 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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "xt-fuzz"
3+
version = "0.0.0"
4+
publish = false
5+
edition = "2021"
6+
7+
[package.metadata]
8+
cargo-fuzz = true
9+
10+
[dependencies]
11+
libfuzzer-sys = "0.4.9"
12+
13+
[dependencies.xt]
14+
path = ".."
15+
16+
[[bin]]
17+
name = "slice_detected_all_formats"
18+
path = "fuzz_targets/slice_detected_all_formats.rs"
19+
test = false
20+
doc = false
21+
bench = false
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![no_main]
2+
3+
use std::io;
4+
5+
use libfuzzer_sys::fuzz_target;
6+
7+
use xt::Format;
8+
9+
fuzz_target!(|data: &[u8]| {
10+
let _ = xt::translate_slice(data, None, Format::Json, io::sink());
11+
let _ = xt::translate_slice(data, None, Format::Msgpack, io::sink());
12+
let _ = xt::translate_slice(data, None, Format::Toml, io::sink());
13+
let _ = xt::translate_slice(data, None, Format::Yaml, io::sink());
14+
});

0 commit comments

Comments
 (0)