From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix another ancient bug in parsing of BRE-mode regular expressio
Date: Fri, 19 Feb 2021 03:39:17 +0000
Message-ID: <E1lCwdR-0004Rq-GM@gemulon.postgresql.org> (raw)
Fix another ancient bug in parsing of BRE-mode regular expressions.
While poking at the regex code, I happened to notice that the bug
squashed in commit afcc8772e had a sibling: next() failed to return
a specific value associated with the '}' token for a "\{m,n\}"
quantifier when parsing in basic RE mode. Again, this could result
in treating the quantifier as non-greedy, which it never should be in
basic mode. For that to happen, the last character before "\}" that
sets "nextvalue" would have to set it to zero, or it'd have to have
accidentally been zero from the start. The failure can be provoked
repeatably with, for example, a bound ending in digit "0".
Like the previous patch, back-patch all the way.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b5a66e7353ba65c11c5fc6a79b72213bde8dbe44
Modified Files
--------------
src/backend/regex/regc_lex.c | 2 +-
src/test/modules/test_regex/expected/test_regex.out | 9 ++++++++-
src/test/modules/test_regex/sql/test_regex.sql | 3 ++-
3 files changed, 11 insertions(+), 3 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix another ancient bug in parsing of BRE-mode regular expressio
In-Reply-To: <E1lCwdR-0004Rq-GM@gemulon.postgresql.org>
References: <E1lCwdR-0004Rq-GM@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox