[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] regex: fix assertion in re_node_set_insert
From: |
Egor Ignatov |
Subject: |
[PATCH] regex: fix assertion in re_node_set_insert |
Date: |
Tue, 22 Jun 2021 18:35:59 +0300 |
* 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