From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11174 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: [PATCH] regex: fix newline matching with negated brackets Date: Tue, 21 Mar 2017 12:25:58 -0400 Message-ID: <20170321162558.GA17319@brightrain.aerifal.cx> References: <6600F15C-80E5-4CAE-8749-F77323C58D17@gmail.com> <4CAE9FC3-77C9-473B-9A48-345C81A578A7@gmail.com> <20170319033043.GN2082@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1490113586 18238 195.159.176.226 (21 Mar 2017 16:26:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 21 Mar 2017 16:26:26 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11189-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 21 17:26:21 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cqMbq-0003Od-Qy for gllmg-musl@m.gmane.org; Tue, 21 Mar 2017 17:26:10 +0100 Original-Received: (qmail 5284 invoked by uid 550); 21 Mar 2017 16:26:13 -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 5245 invoked from network); 21 Mar 2017 16:26:12 -0000 Content-Disposition: inline In-Reply-To: <20170319033043.GN2082@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11174 Archived-At: On Sun, Mar 19, 2017 at 04:30:43AM +0100, Szabolcs Nagy wrote: > * Julien Ramseier [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