Skip to content

Commit af57064

Browse files
committed
automata: Fix broken universal start states with sparse DFA
The state IDs were not remapped, which will usually result in an index out of range error.
1 parent ddeb85e commit af57064

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

regex-automata/src/dfa/sparse.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,14 @@ impl StartTable<Vec<u8>> {
18461846
let new_start_id = remap[dfa.to_index(old_start_id)];
18471847
sl.set_start(anchored, sty, new_start_id);
18481848
}
1849+
for ustart in [
1850+
&mut sl.universal_start_unanchored,
1851+
&mut sl.universal_start_anchored,
1852+
] {
1853+
if let Some(id) = ustart {
1854+
*id = remap[dfa.to_index(*id)];
1855+
}
1856+
}
18491857
Ok(sl)
18501858
}
18511859
}

0 commit comments

Comments
 (0)