File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
2
use libfuzzer_sys:: fuzz_target;
3
3
4
- fuzz_target ! ( |data: & [ u8 ] | {
5
- if data. len( ) < 2 {
6
- return ;
7
- }
8
- let split_point = data[ 0 ] as usize ;
9
- if let Ok ( data) = std:: str :: from_utf8( & data[ 1 ..] ) {
10
- use std:: cmp:: max;
11
- // split data into regular expression and actual input to search through
12
- let len = data. chars( ) . count( ) ;
13
- let split_off_point = max( split_point, 1 ) % len as usize ;
14
- let char_index = data. char_indices( ) . nth( split_off_point) ;
15
- if let Some ( ( char_index, _) ) = char_index {
16
- let ( pattern, input) = data. split_at( char_index) ;
17
- if let Ok ( re) = regex:: Regex :: new( pattern) {
18
- re. is_match( input) ;
19
- }
20
- }
4
+ fuzz_target ! ( |data: ( & str , & str ) | {
5
+ let ( pattern, input) = data;
6
+
7
+ if let Ok ( re) = regex:: Regex :: new( pattern) {
8
+ re. is_match( input) ;
21
9
}
22
10
} ) ;
You can’t perform that action at this time.
0 commit comments