summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-09-12 06:29:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-09-12 06:29:19 -0700
commit656a69fcefc0787ac0c2e22e8b1750e577c4b759 (patch)
tree998303061aa52ca5a942a508d1cbfb70a7e4243e /regex.c
parentfc5935a9fe816d64291e66b1ca5133a27f5f0230 (diff)
downloadtxr-656a69fcefc0787ac0c2e22e8b1750e577c4b759.tar.gz
txr-656a69fcefc0787ac0c2e22e8b1750e577c4b759.tar.bz2
txr-656a69fcefc0787ac0c2e22e8b1750e577c4b759.zip
regex: bugfix: incorrect use of nfa_move_closure.
This goes back to November 2, 2009 commit, "Start of implementation for freestyle matching", 6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d It is exposed if we perform an epsilon threading optimization on the NFA graph. * regex.c (regex_machine_feed): We must pass the new, incremented value of the visited counter, to nfa_move_closure. States have already been tagged with the old value before the call to regex_machine_feed, so we risk failing to visit some states and include them in the closure.
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/regex.c b/regex.c
index ebfd9570..7ff74592 100644
--- a/regex.c
+++ b/regex.c
@@ -2418,7 +2418,7 @@ static regm_result_t regex_machine_feed(regex_machine_t *regm, wchar_t ch)
regm->n.nclos = nfa_move_closure(regm->n.stack,
regm->n.set, regm->n.nclos,
- regm->n.nstates, ch, regm->n.visited++,
+ regm->n.nstates, ch, ++regm->n.visited,
&accept);
if (regm->n.nfa.start)