Skip to content

Commit f07c544

Browse files
initial fuzzer for oss-fuzz integration.
1 parent 5bde47b commit f07c544

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

fuzz/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
target
3+
corpus
4+
artifacts

fuzz/Cargo.toml

Lines changed: 26 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy