diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-02-18 22:38:55 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-02-18 22:38:55 -0500 |
commit | e7cddb5f29171a536233acecb7ac9b9c5e1b4c77 (patch) | |
tree | 8928dbd6c7cf33426873bdf58a3a30cfed611302 /src | |
parent | 6a31b48ec88ae506c6f115948c86f61abb89a89a (diff) | |
download | postgresql-e7cddb5f29171a536233acecb7ac9b9c5e1b4c77.tar.gz postgresql-e7cddb5f29171a536233acecb7ac9b9c5e1b4c77.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/regex/regc_lex.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c index ca2bce48312..16664531641 100644 --- a/src/backend/regex/regc_lex.c +++ b/src/backend/regex/regc_lex.c @@ -389,7 +389,7 @@ next(struct vars *v) { v->now++; INTOCON(L_BRE); - RET('}'); + RETV('}', 1); } else FAILW(REG_BADBR); |