bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Egor Ignatov <egori@altlinux.org>
To: eggert@cs.ucla.edu
Cc: bug-gnulib@gnu.org
Subject: [PATCH] regex: fix assertion in re_node_set_insert
Date: Tue, 22 Jun 2021 18:35:59 +0300	[thread overview]
Message-ID: <20210622153559.1087338-2-egori@altlinux.org> (raw)
In-Reply-To: <20210622153559.1087338-1-egori@altlinux.org>

* lib/regexec.c (proceed_next_node): Add duplicate insertion
check for eps_via_nodes set.

Signed-off-by: Egor Ignatov <egori@altlinux.org>
---
 lib/regexec.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/regexec.c b/lib/regexec.c
index 23b984a21..c05b92783 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1220,10 +1220,12 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
     {
       re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes;
       re_node_set *edests = &dfa->edests[node];
-      bool ok = re_node_set_insert (eps_via_nodes, node);
-      if (__glibc_unlikely (! ok))
-	return -2;
-
+      if(!re_node_set_contains (eps_via_nodes, node))
+	{
+	  bool ok = re_node_set_insert (eps_via_nodes, node);
+	  if (__glibc_unlikely (! ok))
+	    return -2;
+	}
       /* Pick a valid destination, or return -1 if none is found.  */
       Idx dest_node = -1;
       for (Idx i = 0; i < edests->nelem; i++)
-- 
2.29.3



  reply	other threads:[~2021-06-22 15:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26  9:08 [PATCH] regex: fix match with possessive quantifier Egor Ignatov
2021-06-06 21:45 ` Dmitry V. Levin
2021-06-07  1:10   ` Dmitry V. Levin
2021-06-16  9:46     ` [PATCH] regex: fix backreference matching Egor Ignatov
2021-06-16 10:13       ` Dmitry V. Levin
2021-06-29  8:51         ` Egor Ignatov
2021-07-05 12:12           ` Dmitry V. Levin
2021-07-09 12:36             ` [PATCH v2] " Egor Ignatov
2021-06-16 10:18     ` [PATCH] regex: fix match with possessive quantifier Dmitry V. Levin
2021-06-21 21:09   ` Paul Eggert
2021-06-22 15:35     ` Egor Ignatov
2021-06-22 15:35       ` Egor Ignatov [this message]
2021-06-22 19:41         ` [PATCH] regex: fix assertion in re_node_set_insert Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622153559.1087338-2-egori@altlinux.org \
    --to=egori@altlinux.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).