File tree Expand file tree Collapse file tree 5 files changed +81
-0
lines changed Expand file tree Collapse file tree 5 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ target
3+ libfuzzer
Original file line number Diff line number Diff line change 1+
2+ [package ]
3+ name = " unicode-segmentation-fuzz"
4+ version = " 0.0.1"
5+ authors = [" Automatically generated" ]
6+
7+ [dependencies .unicode-segmentation ]
8+ path = " .."
9+
10+ # Prevent this from interfering with workspaces
11+ [workspace ]
12+ members = [" ." ]
13+
14+ [[bin ]]
15+ name = " graphemes"
16+ path = " fuzzers/graphemes.rs"
17+
18+ [[bin ]]
19+ name = " words"
20+ path = " fuzzers/words.rs"
21+
22+ [[bin ]]
23+ name = " equality"
24+ path = " fuzzers/equality.rs"
Original file line number Diff line number Diff line change 1+ #![ no_main]
2+
3+ extern crate libfuzzer_sys;
4+ extern crate unicode_segmentation;
5+ use std:: str;
6+ use unicode_segmentation:: UnicodeSegmentation ;
7+ #[ export_name="rust_fuzzer_test_input" ]
8+ pub extern fn go ( data : & [ u8 ] ) {
9+ if let Ok ( s) = str:: from_utf8 ( data) {
10+ let result = UnicodeSegmentation :: graphemes ( s, true ) . flat_map ( |s| s. chars ( ) ) . collect :: < String > ( ) ;
11+ assert_eq ! ( s, result) ;
12+ let result = s. split_word_bounds ( ) . flat_map ( |s| s. chars ( ) ) . collect :: < String > ( ) ;
13+ assert_eq ! ( s, result) ;
14+
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ #![ no_main]
2+
3+
4+ extern crate libfuzzer_sys;
5+
6+
7+ extern crate unicode_segmentation;
8+
9+ use unicode_segmentation:: UnicodeSegmentation ;
10+ use std:: str;
11+
12+
13+ #[ export_name="rust_fuzzer_test_input" ]
14+ pub extern fn go ( data : & [ u8 ] ) {
15+ if let Ok ( s) = str:: from_utf8 ( data) {
16+ let g = UnicodeSegmentation :: graphemes ( s, true ) . collect :: < Vec < _ > > ( ) ;
17+ assert ! ( UnicodeSegmentation :: graphemes( s, true ) . rev( ) . eq( g. iter( ) . rev( ) . cloned( ) ) ) ;
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ #![ no_main]
2+
3+
4+ extern crate libfuzzer_sys;
5+
6+
7+ extern crate unicode_segmentation;
8+
9+ use unicode_segmentation:: UnicodeSegmentation ;
10+ use std:: str;
11+
12+
13+ #[ export_name="rust_fuzzer_test_input" ]
14+ pub extern fn go ( data : & [ u8 ] ) {
15+ if let Ok ( s) = str:: from_utf8 ( data) {
16+ let g = s. split_word_bounds ( ) . collect :: < Vec < _ > > ( ) ;
17+ assert ! ( s. split_word_bounds( ) . rev( ) . eq( g. iter( ) . rev( ) . cloned( ) ) ) ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments