From 0b4fa3dada84dc3da0d3efee9327f8db26d59903 Mon Sep 17 00:00:00 2001 From: Egor Ignatov Date: Wed, 26 May 2021 12:08:19 +0300 Subject: [PATCH] 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 --- lib/regexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.39.5