Skip to content

Commit aaf211b

Browse files
MrmaxmeierBurntSushi
authored andcommitted
automata: add regression test for dense::DFA::from_bytes validation panic
1 parent 1df9a33 commit aaf211b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

regex-automata/src/dfa/dense.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5234,4 +5234,17 @@ mod tests {
52345234
let got = dfa.try_search_rev(&input);
52355235
assert_eq!(Err(expected), got);
52365236
}
5237+
5238+
// This panics in TransitionTable::validate if the match states are not validated first.
5239+
#[test]
5240+
fn regression_validation_order() {
5241+
let mut dfa = DFA::new("abc").unwrap();
5242+
dfa.ms = MatchStates {
5243+
slices: vec![],
5244+
pattern_ids: vec![],
5245+
pattern_len: 1,
5246+
};
5247+
let (buf, _) = dfa.to_bytes_native_endian();
5248+
DFA::from_bytes(&buf).unwrap_err();
5249+
}
52375250
}

0 commit comments

Comments
 (0)