Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 21 Mar 2017 12:25:58 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Re: [PATCH] regex: fix newline matching with negated
 brackets

On Sun, Mar 19, 2017 at 04:30:43AM +0100, Szabolcs Nagy wrote:
> * Julien Ramseier <j.ramseier@...il.com> [2017-03-18 16:00:11 +0100]:
> > diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
> > index 5a7b53a..fb24556 100644
> > --- a/src/regex/regcomp.c
> > +++ b/src/regex/regcomp.c
> > @@ -636,6 +636,20 @@ static reg_errcode_t parse_bracket(tre_parse_ctx_t *ctx, const char *s)
> >  		goto parse_bracket_done;
> >  
> >  	if (neg.negate) {
> > +		/*
> > +		 * With REG_NEWLINE, POSIX requires that newlines are not matched by
> > +		 * any form of a non-matching list.
> > +		 */
> > +		if (ctx->cflags & REG_NEWLINE) {
> > +			lit = tre_new_lit(&ls);
> > +			if (!lit) {
> > +				err = REG_ESPACE;
> > +				goto parse_bracket_done;
> > +			}
> > +			lit->code_min = '\n';
> > +			lit->code_max = '\n';
> > +			lit->position = -1;
> > +		}
> >  		/* Sort the array if we need to negate it. */
> >  		qsort(ls.a, ls.len, sizeof *ls.a, tre_compare_lit);
> >  		/* extra lit for the last negated range */
> > 
> 
> looks good.
> thanks

Thanks for reviewing. Committing it.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.