pgsql: Fix another ancient bug in parsing of BRE-mode regular expressio

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix another ancient bug in parsing of BRE-mode regular expressio
Date: 2021-02-19 03:39:17
Message-ID: E1lCwdR-0004Rx-HY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6e6fecf495386e8aebfdc71ad6998eceb9da45e3

Modified Files
--------------
src/backend/regex/regc_lex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2021-02-19 05:18:08 pgsql: Add nbtree README section on page recycling.
Previous Message Fujii Masao 2021-02-18 14:31:24 pgsql: Fix "invalid spinlock number: 0" error in pg_stat_wal_receiver.