File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 33use {
44 libfuzzer_sys:: { fuzz_target, Corpus } ,
55 regex:: RegexBuilder ,
6- regex_automata:: nfa:: thompson:: pikevm:: PikeVM as NfaRegex ,
6+ regex_automata:: nfa:: thompson:: { pikevm:: PikeVM as NfaRegex , NFA } ,
77 regex_syntax:: ast:: Ast ,
88} ;
99
@@ -26,11 +26,15 @@ fuzz_target!(|data: FuzzData| -> Corpus {
2626 let _ = env_logger:: try_init( ) ;
2727
2828 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 {
3030 return Corpus :: Reject ;
3131 } ;
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 ;
3438 } ;
3539 let mut cache = baseline. create_cache( ) ;
3640
You can’t perform that action at this time.
0 commit comments