Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 19 Apr 2020 21:26:35 -0400
From: Rich Felker <dalias@...c.org>
To: "liheng (P)" <liheng40@...wei.com>
Cc: Szabolcs Nagy <nsz@...t70.net>,
	"musl@...ts.openwall.com" <musl@...ts.openwall.com>,
	Florian Weimer <fw@...eb.enyo.de>,
	"Xiangrui (Euler)" <rui.xiang@...wei.com>,
	Lizefan <lizefan@...wei.com>
Subject: Re: regex Back reference matching result not same as glibc
 and tre.

On Sun, Apr 19, 2020 at 12:26:58PM +0000, liheng (P) wrote:
> Ok, you are right, I retest to match "aba" by pat[] =
> "\\(.\\?\\).\\?\\1" success without tags (basic regular expression
> mode I think). regcomp1(&rbuf, pat, 0);
> 
> But my point is that why pat[] = "(.?).?\\1" to match "aba" in
> extended regular expression mode that success in glibc and failed in
> musl? Are musl-regex and glibc-regex different?

Having backreferences in regular expressions is inherently a bug,
because it makes them non-regular and unsafe for use where the
expression is user input and finishing in finite time is a
requirement. They're supported in BRE because it's a historical
requirement impossed by the standard, but a major *feature* of ERE is
actually being regular and not having backreferences.

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.