* [PATCH] fix the use of uninitialized value in regcomp
@ 2016-05-21 13:21 Szabolcs Nagy
0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2016-05-21 13:21 UTC (permalink / raw)
To: musl; +Cc: John Regehr
the num_submatches field of some ast nodes was not initialized in
tre_add_tag_{left,right}, but was accessed later.
this was a benign bug since the uninitialized values were never used
(these values are created during tre_add_tags and copied around during
tre_expand_ast where they are also used in computations, but nothing
in the final tnfa depends on them).
---
src/regex/regcomp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index 5fad98b..65f2fd0 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -1106,6 +1106,7 @@ tre_add_tag_left(tre_mem_t mem, tre_ast_node_t *node, int tag_id)
c->right->firstpos = NULL;
c->right->lastpos = NULL;
c->right->num_tags = 0;
+ c->right->num_submatches = 0;
node->obj = c;
node->type = CATENATION;
return REG_OK;
@@ -1136,6 +1137,7 @@ tre_add_tag_right(tre_mem_t mem, tre_ast_node_t *node, int tag_id)
c->left->firstpos = NULL;
c->left->lastpos = NULL;
c->left->num_tags = 0;
+ c->left->num_submatches = 0;
node->obj = c;
node->type = CATENATION;
return REG_OK;
--
2.8.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-21 13:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-21 13:21 [PATCH] fix the use of uninitialized value in regcomp Szabolcs Nagy
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).