Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "dot_vox-fuzz"
version = "0.0.0"
edition = "2021"
publish = false

[package.metadata]
cargo-fuzz = true

[dependencies]
dot_vox = { path = ".." }
libfuzzer-sys = "0.4"

# Prevent this from interfering with workspaces
[workspace]
members = ["."]

[[bin]]
name = "fuzz_load_bytes"
path = "fuzz_targets/fuzz_load_bytes.rs"
test = false
doc = false
9 changes: 9 additions & 0 deletions fuzz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This package contains fuzz tests for `dot_vox`, which may detect cases where the
parser panics (or even crashes, or allocates excessive memory) rather than
returning an error.

For more information on fuzz testing and how to run these tests, see
[Rust Fuzz Book - Fuzzing with cargo-fuzz][1].


[1]: https://rust-fuzz.github.io/book/cargo-fuzz.html
9 changes: 9 additions & 0 deletions fuzz/fuzz_targets/fuzz_load_bytes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![no_main]
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
// The fuzzer does not know or care what valid .vox data looks like.
// Therefore, this fuzz test can never _expect success;_ only expect failures to
// be reported via `Err` instead of panic.
let _ = dot_vox::load_bytes(data);
});