Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jul 2017 22:00:39 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320796 - head/lib/libc/regex
Message-ID:  <201707072200.v67M0dl8029235@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Fri Jul  7 22:00:39 2017
New Revision: 320796
URL: https://svnweb.freebsd.org/changeset/base/320796

Log:
  Correctly ignore branch operators in the top-level parser when applicable.
  
  An oversight in r320742 caused BREs to become sensitive to the branching operator prematurely, which caused
  breakage in some limited situations -- namely, those that tried to use branching in a BRE. Most of these scenarios
  had already been corrected beforehand to properly use gsed or grep for GNU extensions, so the damage is
  slightly mitigated.
  
  Reported by: antoine
  
  Reported by:	antoine
  Approved by:	emaste (mentor)
  Differential Revision:	https://reviews.freebsd.org/D11522

Modified:
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/regex/regcomp.c
==============================================================================
--- head/lib/libc/regex/regcomp.c	Fri Jul  7 21:33:06 2017	(r320795)
+++ head/lib/libc/regex/regcomp.c	Fri Jul  7 22:00:39 2017	(r320796)
@@ -672,7 +672,7 @@ p_re(struct parse *p,
 		bc.terminate = false;
 		if (p->pre_parse != NULL)
 			p->pre_parse(p, &bc);
-		while (MORE() && !SEESPEC('|') && !SEEEND()) {
+		while (MORE() && (!p->allowbranch || !SEESPEC('|')) && !SEEEND()) {
 			bc.terminate = p->parse_expr(p, &bc);
 			++bc.nchain;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707072200.v67M0dl8029235>