This commit is contained in:
Robin Appelman 2022-12-24 19:26:24 +01:00
commit f4f173c84e
11 changed files with 134 additions and 52 deletions

1
fuzz/.envrc Normal file
View file

@ -0,0 +1 @@
use flake

5
fuzz/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
target
corpus
artifacts
.direnv
result

25
fuzz/Cargo.toml Normal file
View file

@ -0,0 +1,25 @@
[package]
name = "vmdl-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.vmdl]
path = ".."
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "fuzz_target_1"
path = "fuzz_targets/fuzz_target_1.rs"
test = false
doc = false

22
fuzz/flake.nix Normal file
View file

@ -0,0 +1,22 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/release-22.11";
};
outputs = {
self,
nixpkgs,
utils,
}:
utils.lib.eachDefaultSystem (system: let
pkgs = (import nixpkgs) {
inherit system;
};
in rec {
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [rustup cargo-edit cargo-fuzz];
};
});
}

6
fuzz/fuzz_targets/mdl.rs Normal file
View file

@ -0,0 +1,6 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
});

8
fuzz/fuzz_targets/vtx.rs Normal file
View file

@ -0,0 +1,8 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
fn fuzz(data: &[u8]) {
let _ = vmdl::Mdl::read(data).ok();
}
fuzz_target!(|data: &[u8]| {fuzz(data)});

8
fuzz/fuzz_targets/vvd.rs Normal file
View file

@ -0,0 +1,8 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
fn fuzz(data: &[u8]) {
let _ = vmdl::Mdl::read(data).ok();
}
fuzz_target!(|data: &[u8]| {fuzz(data)});