This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix regexp parsing with RE_CONTEXT_INDEP_OPS


When parsed with RE_SYNTAX_EGREP (which includes RE_CONTEXT_INDEP_OPS)
the regexp "(*)b" results in the error "unmatched ) or \)", but it
should compile successfully (treating it as if "()b").  This is part
of the Spencer tests in grep.

Andreas.

2003-12-13  Andreas Schwab  <schwab@suse.de>

	* posix/regcomp.c (parse_expression): Don't recurse when the end
	of a subexp is seen after a repetition operator with
	RE_CONTEXT_INVALID_DUP.

--- posix/regcomp.c.~1.67.~	2003-11-30 00:08:06.000000000 +0100
+++ posix/regcomp.c	2003-12-13 09:59:26.000000000 +0100
@@ -2191,6 +2191,8 @@ parse_expression (regexp, preg, token, s
       else if (syntax & RE_CONTEXT_INDEP_OPS)
 	{
 	  fetch_token (token, regexp, syntax);
+	  if (token->type == OP_CLOSE_SUBEXP || token->type == OP_ALT)
+	    return NULL;
 	  return parse_expression (regexp, preg, token, syntax, nest, err);
 	}
       /* else fall through  */

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]