Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add fuzzers#18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Manishearth wants to merge1 commit intounicode-rs:master
base:master
Choose a base branch
Loading
fromManishearth:fuzz
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsfuzz/.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@

target
libfuzzer
24 changes: 24 additions & 0 deletionsfuzz/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@

[package]
name = "unicode-segmentation-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]

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

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

[[bin]]
name = "graphemes"
path = "fuzzers/graphemes.rs"

[[bin]]
name = "words"
path = "fuzzers/words.rs"

[[bin]]
name = "equality"
path = "fuzzers/equality.rs"
16 changes: 16 additions & 0 deletionsfuzz/fuzzers/equality.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
#![no_main]

extern crate libfuzzer_sys;
extern crate unicode_segmentation;
use std::str;
use unicode_segmentation::UnicodeSegmentation;
#[export_name="rust_fuzzer_test_input"]
pub extern fn go(data: &[u8]) {
if let Ok(s) = str::from_utf8(data) {
let result = UnicodeSegmentation::graphemes(s, true).flat_map(|s| s.chars()).collect::<String>();
assert_eq!(s, result);
let result = s.split_word_bounds().flat_map(|s| s.chars()).collect::<String>();
assert_eq!(s, result);

}
}
19 changes: 19 additions & 0 deletionsfuzz/fuzzers/graphemes.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
#![no_main]


extern crate libfuzzer_sys;


extern crate unicode_segmentation;

use unicode_segmentation::UnicodeSegmentation;
use std::str;


#[export_name="rust_fuzzer_test_input"]
pub extern fn go(data: &[u8]) {
if let Ok(s) = str::from_utf8(data) {
let g = UnicodeSegmentation::graphemes(s, true).collect::<Vec<_>>();
assert!(UnicodeSegmentation::graphemes(s, true).rev().eq(g.iter().rev().cloned()));
}
}
19 changes: 19 additions & 0 deletionsfuzz/fuzzers/words.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
#![no_main]


extern crate libfuzzer_sys;


extern crate unicode_segmentation;

use unicode_segmentation::UnicodeSegmentation;
use std::str;


#[export_name="rust_fuzzer_test_input"]
pub extern fn go(data: &[u8]) {
if let Ok(s) = str::from_utf8(data) {
let g = s.split_word_bounds().collect::<Vec<_>>();
assert!(s.split_word_bounds().rev().eq(g.iter().rev().cloned()));
}
}

[8]ページ先頭

©2009-2025 Movatter.jp