Skip to content

automata: report match state patterns at correct offset in reverse overlapping search (#1418) - #1426

Open
Yshuro wants to merge 1 commit into
rust-lang:masterfrom
Yshuro:fix/overlapping-rev-match-offset
Open

Yshuro wants to merge 1 commit into
rust-lang:masterfrom
Yshuro:fix/overlapping-rev-match-offset

Conversation

@Yshuro

@Yshuro Yshuro commented Nov 19, 2026

Copy link
Copy Markdown

In reverse overlapping searches (\ ry_search_overlapping_rev), when a match state contained multiple patterns, the first pattern was reported at offset \state.at + 1\ (or \state.at\ on EOI), but subsequent patterns of that same state were emitted with offset \state.at. As a result, subsequent matches of the same match state were reported one byte too early when not at EOI.

This PR adjusts both the full DFA (\dfa::search::find_overlapping_rev) and lazy DFA (\hybrid::search::find_overlapping_rev) to compute the offset as \if state.rev_eoi { state.at } else { state.at + 1 }\ for subsequent patterns of a match state as well.

Fixes #1418.

…erlapping search (rust-lang#1418)

Signed-off-by: Sami Chergui <83331159+Yshuro@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regex-automata: try_search_overlapping_rev reports patterns of a match state one byte early

1 participant