Skip to content

Commit

Permalink
Add fuzz tests for unfill and refill
Browse files Browse the repository at this point in the history
Thanks to @A-Walrus in #466 for the idea.
  • Loading branch information
mgeisler committed Sep 13, 2022
1 parent 66856ac commit 16bd549
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ jobs:
- wrap_first_fit
- wrap_optimal_fit
- wrap_optimal_fit_usize
- unfill
- refill

steps:
- name: Checkout repository
Expand Down
12 changes: 12 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ name = "wrap_optimal_fit_usize"
path = "fuzz_targets/wrap_optimal_fit_usize.rs"
test = false
doc = false

[[bin]]
name = "refill"
path = "fuzz_targets/refill.rs"
test = false
doc = false

[[bin]]
name = "unfill"
path = "fuzz_targets/unfill.rs"
test = false
doc = false
6 changes: 6 additions & 0 deletions fuzz/fuzz_targets/refill.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![no_main]
use libfuzzer_sys::fuzz_target;

fuzz_target!(|input: (String, usize)| {
let _ = textwrap::refill(&input.0, input.1);
});
6 changes: 6 additions & 0 deletions fuzz/fuzz_targets/unfill.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![no_main]
use libfuzzer_sys::fuzz_target;

fuzz_target!(|input: String| {
let _ = textwrap::unfill(&input);
});

0 comments on commit 16bd549

Please sign in to comment.