Skip to content

Commit

Permalink
Merge pull request #94 from DavidKorczynski/master
Browse files Browse the repository at this point in the history
initial fuzzer for oss-fuzz integration.
  • Loading branch information
Manishearth authored Apr 1, 2021
2 parents 5bde47b + f07c544 commit 573b7bb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target
corpus
artifacts
26 changes: 26 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

[package]
name = "unicode-segmentation-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"

[package.metadata]
cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.4"

[dependencies.unicode-segmentation]
path = ".."

# Prevent this from interfering with workspaces
[workspace]
members = ["."]

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

fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
let _g = s.graphemes(true).collect::<Vec<&str>>();
let _w = s.unicode_words().collect::<Vec<&str>>();
let _ws = s.split_word_bounds().collect::<Vec<&str>>();
}
});

0 comments on commit 573b7bb

Please sign in to comment.