diff options
| -rw-r--r-- | .github/workflows/ci.yml | 21 | ||||
| -rw-r--r-- | lib/header/fuzz/.gitignore | 4 | ||||
| -rw-r--r-- | lib/header/fuzz/Cargo.lock | 63 | ||||
| -rw-r--r-- | lib/header/fuzz/Cargo.toml | 24 | ||||
| -rw-r--r-- | lib/header/fuzz/fuzz_targets/fuzz_target_header.rs | 7 |
5 files changed, 119 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 589ccbe..66c9075 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,3 +67,24 @@ jobs: run: | cd lib/xixanta cargo +nightly fuzz run fuzz_target_2 -- -max_total_time=180 + + fuzz_header: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Update rust toolchain to nightly + run: | + rustup update nightly + rustup default nightly + + - name: Install cargo fuzz + run: cargo install cargo-fuzz + + - name: Build with nightly + run: cargo build --verbose + + - name: Fuzzy test the header parser + run: | + cd lib/header + cargo +nightly fuzz run fuzz_target_header -- -max_total_time=180 diff --git a/lib/header/fuzz/.gitignore b/lib/header/fuzz/.gitignore new file mode 100644 index 0000000..1a45eee --- /dev/null +++ b/lib/header/fuzz/.gitignore @@ -0,0 +1,4 @@ +target +corpus +artifacts +coverage diff --git a/lib/header/fuzz/Cargo.lock b/lib/header/fuzz/Cargo.lock new file mode 100644 index 0000000..190ed38 --- /dev/null +++ b/lib/header/fuzz/Cargo.lock @@ -0,0 +1,63 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" + +[[package]] +name = "cc" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "header" +version = "0.1.0" + +[[package]] +name = "header-fuzz" +version = "0.0.0" +dependencies = [ + "header", + "libfuzzer-sys", +] + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.168" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b9569d2f74e257076d8c6bfa73fb505b46b851e51ddaecc825944aa3bed17fa" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" diff --git a/lib/header/fuzz/Cargo.toml b/lib/header/fuzz/Cargo.toml new file mode 100644 index 0000000..9ea48be --- /dev/null +++ b/lib/header/fuzz/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "header-fuzz" +version = "0.0.0" +publish = false +edition = "2021" + +[workspace] +members = [] + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" + +[dependencies.header] +path = ".." + +[[bin]] +name = "fuzz_target_header" +path = "fuzz_targets/fuzz_target_header.rs" +test = false +doc = false +bench = false diff --git a/lib/header/fuzz/fuzz_targets/fuzz_target_header.rs b/lib/header/fuzz/fuzz_targets/fuzz_target_header.rs new file mode 100644 index 0000000..794853a --- /dev/null +++ b/lib/header/fuzz/fuzz_targets/fuzz_target_header.rs @@ -0,0 +1,7 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = header::Header::try_from(data); +}); |
