Skip to content

Commit

Permalink
Add fuzz test
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Wagner <[email protected]>
  • Loading branch information
nwagner84 committed Sep 21, 2024
1 parent a8073c2 commit 954fea3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ jobs:
strategy:
matrix:
item:
- { name: pica-format, fuzz-dir: crates/pica-format/fuzz, target: fuzz-format, max-total-time: 300 }
- { name: pica-path, fuzz-dir: crates/pica-path/fuzz, target: fuzz-path, max-total-time: 300 }
- { name: pica-record-matcher, fuzz-dir: crates/pica-matcher/fuzz, target: fuzz-record-matcher, max-total-time: 300 }
- { name: pica-record-ref-v1, fuzz-dir: crates/pica-record-v1/fuzz, target: fuzz-record-ref, max-total-time: 300 }
- { name: pica-select-query, fuzz-dir: crates/pica-select/fuzz, target: fuzz-query, max-total-time: 300 }
- { name: pica-record-ref, fuzz-dir: fuzz, target: fuzz-record-ref, max-total-time: 300 }
- { name: pica-format, fuzz-dir: crates/pica-format/fuzz, target: fuzz-format, max-total-time: 120 }
- { name: pica-path, fuzz-dir: crates/pica-path/fuzz, target: fuzz-path, max-total-time: 120 }
- { name: pica-record-matcher-v1, fuzz-dir: crates/pica-matcher/fuzz, target: fuzz-record-matcher, max-total-time: 120 }
- { name: pica-record-ref-v1, fuzz-dir: crates/pica-record-v1/fuzz, target: fuzz-record-ref, max-total-time: 120 }
- { name: pica-select-query, fuzz-dir: crates/pica-select/fuzz, target: fuzz-query, max-total-time: 120 }
- { name: pica-record-ref, fuzz-dir: fuzz, target: fuzz-record-ref, max-total-time: 400 }
- { name: pica-record-matcher, fuzz-dir: fuzz, target: fuzz-record-matcher, max-total-time: 400 }
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
Expand Down
7 changes: 7 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ path = "fuzz_targets/fuzz_record_ref.rs"
test = false
doc = false
bench = false

[[bin]]
name = "fuzz-record-matcher"
path = "fuzz_targets/fuzz_record_matcher.rs"
test = false
doc = false
bench = false
10 changes: 10 additions & 0 deletions fuzz/fuzz_targets/fuzz_record_matcher.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use pica_record::prelude::*;

fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
let _ = RecordMatcher::new(s);
}
});

0 comments on commit 954fea3

Please sign in to comment.