Commit d94f955
committed
dfa: fix bug in how the reverse DFA is called
In turns out that in *some* calls to Fsm::reverse, we were passing an
incorrect start offset. Namely, the haystack we pass is sub-sliced at
`&text[start..]`, but in some places, we were passing `text.len()` as
the start offset of the reverse search. But of course, it should be
`text.len() - start`. This was indeed the case in most places, but it
looks like it needed to be corrected in two additional places.
I've also added this test to regex-automata's set of regression tests
and can confirm that it doesn't happen there. (regex-automata is far
more principled about handling offsets like this.)
Fixes #9691 parent 32fed94 commit d94f955
2 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
| 514 | + | |
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
0 commit comments