]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
regex: fix match with possessive quantifier
authorEgor Ignatov <egori@altlinux.org>
Wed, 26 May 2021 09:08:19 +0000 (12:08 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 6 Jun 2021 08:00:00 +0000 (08:00 +0000)
Fix behaviour introduced in 70b673eb7, where regexps with
possessive quantifier("*+") didn't match.

* lib/regexec.c (set_regs): Pop if CUR_NODE has already been checked
only when we have a fail stack.

Fixes: 70b673eb7 ("regex: fix longstanding backref match bug")
Signed-off-by: Egor Ignatov <egori@altlinux.org>
lib/regexec.c

index 6309deac8b78b60766d4518af0242c84629b0019..5d4113c9d3eea73f0dedf6007db5e21443c63851 100644 (file)
@@ -1414,7 +1414,7 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
       update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
 
       if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
-         || re_node_set_contains (&eps_via_nodes, cur_node))
+         || (fs && re_node_set_contains (&eps_via_nodes, cur_node)))
        {
          Idx reg_idx;
          cur_node = -1;