-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial fuzzer setup, runs `cargo fuzz` on a schedule like Vortex repo. There was an out-of-bound access in the `compress` function when loading the last 8 byte word. I replaced it with a copy that is safer while also preserving our existing performance.
- Loading branch information
Showing
8 changed files
with
203 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Fuzz | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # daily | ||
workflow_dispatch: | ||
|
||
jobs: | ||
fuzz: | ||
name: "fuzz" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install cargo fuzz | ||
run: cargo install cargo-fuzz | ||
- name: Run fuzzing target | ||
run: cargo fuzz run fuzz_compress -- -max_total_time=600 | ||
continue-on-error: true | ||
- name: Archive crash artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: fuzzing-crash-artifacts | ||
path: fuzz/artifacts | ||
- name: Archive fuzzing corpus | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: fuzzing-corpus | ||
path: fuzz/corpus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[package] | ||
name = "fsst-rs-fuzz" | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
|
||
[dependencies.fsst-rs] | ||
path = ".." | ||
|
||
[[bin]] | ||
name = "fuzz_train" | ||
path = "fuzz_targets/fuzz_train.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz_compress" | ||
path = "fuzz_targets/fuzz_compress.rs" | ||
test = false | ||
doc = false | ||
bench = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let table = fsst_rs::train("the quick brown fox jumped over the lazy dog".as_bytes()); | ||
let compress = table.compress(data); | ||
let decompress = table.decompress(&compress); | ||
assert_eq!(&decompress, data); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let _ = fsst_rs::train(data); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters