From: Egor Ignatov Date: Wed, 26 May 2021 09:08:19 +0000 (+0300) Subject: regex: fix match with possessive quantifier X-Git-Tag: v1.0~2851 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b4fa3dada84dc3da0d3efee9327f8db26d59903;p=thirdparty%2Fgnulib.git regex: fix match with possessive quantifier 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 --- diff --git a/lib/regexec.c b/lib/regexec.c index 6309deac8b..5d4113c9d3 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -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;