From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10040 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] fix the use of uninitialized value in regcomp Date: Sat, 21 May 2016 15:21:38 +0200 Message-ID: <20160521132138.GI22574@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1463836918 30665 80.91.229.3 (21 May 2016 13:21:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 May 2016 13:21:58 +0000 (UTC) Cc: John Regehr To: musl@lists.openwall.com Original-X-From: musl-return-10053-gllmg-musl=m.gmane.org@lists.openwall.com Sat May 21 15:21:58 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1b46qr-0005cO-Px for gllmg-musl@m.gmane.org; Sat, 21 May 2016 15:21:57 +0200 Original-Received: (qmail 23695 invoked by uid 550); 21 May 2016 13:21:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 23636 invoked from network); 21 May 2016 13:21:49 -0000 Mail-Followup-To: musl@lists.openwall.com, John Regehr Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:10040 Archived-At: 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