aboutsummaryrefslogtreecommitdiff
path: root/src/backend/regex
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-02-18 22:38:55 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2021-02-18 22:38:55 -0500
commitb0645097962575eee3546d7a65420f7c78725cec (patch)
tree06fcf39c8650e7f36220dc5ea8dc1aa5af291b8f /src/backend/regex
parent26812bcaa664b17843b3dbc8803551d720109b6e (diff)
downloadpostgresql-b0645097962575eee3546d7a65420f7c78725cec.tar.gz
postgresql-b0645097962575eee3546d7a65420f7c78725cec.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/backend/regex')
-rw-r--r--src/backend/regex/regc_lex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c
index 1b5f7b66026..abe39987e7d 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);