1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 18:54:05 +02:00

fuzz init

This commit is contained in:
Robin Appelman 2022-12-21 22:49:02 +01:00
commit 697052897e
7 changed files with 104 additions and 1 deletions

View file

@ -16,7 +16,7 @@
in rec { in rec {
# `nix develop` # `nix develop`
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit cargo-msrv]; nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit cargo-msrv cargo-fuzz];
}; };
}); });
} }

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
result
.direnv

25
fuzz/Cargo.toml Normal file
View file

@ -0,0 +1,25 @@
[package]
name = "vbsp-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.vbsp]
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

42
fuzz/flake.lock generated Normal file
View file

@ -0,0 +1,42 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1671652719,
"narHash": "sha256-bKwe16yUenQNzsiXZ+iLLiC5PG6NAkoJLFx61O2rb1o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f4eddbd6a88c51e9a4693e2887cf4543917aa279",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "release-22.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

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];
};
});
}

View file

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