Skip to content

Commit

Permalink
Run fuzzer in CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Sep 22, 2024
1 parent 8416fe9 commit 52edb2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,19 @@ jobs:
path: './pages/dist/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v2
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Install cargo-fuzz
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-fuzz
locked: false
- name: Fuzz
run: RUST_BACKTRACE=1 cargo fuzz run fuzz -- -max_total_time=900
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ libfuzzer-sys = "0.4"

[dependencies.rustrict]
path = ".."
features = ["width"]
features = ["pii", "width"]

# Prevent this from interfering with workspaces
[workspace]
Expand Down
1 change: 1 addition & 0 deletions fuzz/fuzz_targets/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fuzz_target!(|data: &[u8]| {
if let Ok(text) = std::str::from_utf8(input) {
let _ = rustrict::width_str(text);
let _ = rustrict::trim_to_width(text, 10);
let _ = rustrict::censor_and_analyze_pii(text);

let (_censored, _analysis) = Censor::from_str(text)
.with_ignore_self_censoring(flag(flags, 0))
Expand Down

0 comments on commit 52edb2d

Please sign in to comment.