File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 3
3
use {
4
4
libfuzzer_sys:: { fuzz_target, Corpus } ,
5
5
regex:: RegexBuilder ,
6
- regex_automata:: nfa:: thompson:: pikevm:: PikeVM as NfaRegex ,
6
+ regex_automata:: nfa:: thompson:: { pikevm:: PikeVM as NfaRegex , NFA } ,
7
7
regex_syntax:: ast:: Ast ,
8
8
} ;
9
9
@@ -26,11 +26,15 @@ fuzz_target!(|data: FuzzData| -> Corpus {
26
26
let _ = env_logger:: try_init( ) ;
27
27
28
28
let pattern = format!( "{}" , data. ast) ;
29
- let Ok ( re) = RegexBuilder :: new( & pattern) . size_limit( 1 << 20 ) . build( ) else {
29
+ let Ok ( re) = RegexBuilder :: new( & pattern) . size_limit( 1 << 20 ) . build( ) else {
30
30
return Corpus :: Reject ;
31
31
} ;
32
- let Ok ( baseline) = NfaRegex :: new( & pattern) else {
33
- return Corpus :: Reject ; // should we error here?
32
+ let config = NFA :: config( ) . nfa_size_limit( Some ( 1 << 20 ) ) ;
33
+ let Ok ( nfa) = NFA :: compiler( ) . configure( config) . build( & pattern) else {
34
+ return Corpus :: Reject ;
35
+ } ;
36
+ let Ok ( baseline) = NfaRegex :: new_from_nfa( nfa) else {
37
+ return Corpus :: Reject ;
34
38
} ;
35
39
let mut cache = baseline. create_cache( ) ;
36
40
You can’t perform that action at this time.
0 commit comments