File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2340,10 +2340,14 @@ impl<'a> DFA<&'a [u32]> {
23402340 // table, match states and accelerators below. If any validation fails,
23412341 // then we return an error.
23422342 let ( dfa, nread) = unsafe { DFA :: from_bytes_unchecked ( slice) ? } ;
2343+ // Note: Validation order is important here:
2344+ // - MatchState::validate can be called with an untrusted DFA.
2345+ // - TransistionTable::validate uses dfa.ms through match_len
2346+ // - StartTable::validate needs a valid transition table
2347+ dfa. accels . validate ( ) ?;
2348+ dfa. ms . validate ( & dfa) ?;
23432349 dfa. tt . validate ( & dfa) ?;
23442350 dfa. st . validate ( & dfa) ?;
2345- dfa. ms . validate ( & dfa) ?;
2346- dfa. accels . validate ( ) ?;
23472351 // N.B. dfa.special doesn't have a way to do unchecked deserialization,
23482352 // so it has already been validated.
23492353 for state in dfa. states ( ) {
You can’t perform that action at this time.
0 commit comments