Skip to content

Commit 573b7bb

Browse files
authored
Merge pull request #94 from DavidKorczynski/master
initial fuzzer for oss-fuzz integration.
2 parents 5bde47b + f07c544 commit 573b7bb

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

fuzz/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
target
3+
corpus
4+
artifacts

fuzz/Cargo.toml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
[package]
3+
name = "unicode-segmentation-fuzz"
4+
version = "0.0.0"
5+
authors = ["Automatically generated"]
6+
publish = false
7+
edition = "2018"
8+
9+
[package.metadata]
10+
cargo-fuzz = true
11+
12+
[dependencies]
13+
libfuzzer-sys = "0.4"
14+
15+
[dependencies.unicode-segmentation]
16+
path = ".."
17+
18+
# Prevent this from interfering with workspaces
19+
[workspace]
20+
members = ["."]
21+
22+
[[bin]]
23+
name = "fuzz_target_1"
24+
path = "fuzz_targets/fuzz_target_1.rs"
25+
test = false
26+
doc = false

fuzz/fuzz_targets/fuzz_target_1.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![no_main]
2+
use libfuzzer_sys::fuzz_target;
3+
use unicode_segmentation::UnicodeSegmentation;
4+
5+
fuzz_target!(|data: &[u8]| {
6+
if let Ok(s) = std::str::from_utf8(data) {
7+
let _g = s.graphemes(true).collect::<Vec<&str>>();
8+
let _w = s.unicode_words().collect::<Vec<&str>>();
9+
let _ws = s.split_word_bounds().collect::<Vec<&str>>();
10+
}
11+
});

0 commit comments

Comments
 (0)