aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/network_gist.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-01-08 12:16:00 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2021-01-08 12:16:00 -0500
commit49c928c0c067a8ec0882eeea5c03ccbd1b1b1a62 (patch)
tree45f9b299ca352aa0555da8910778f07b8453af08 /src/backend/utils/adt/network_gist.c
parent5ba046948ed49c326d124261ae354bd9fae96489 (diff)
downloadpostgresql-49c928c0c067a8ec0882eeea5c03ccbd1b1b1a62.tar.gz
postgresql-49c928c0c067a8ec0882eeea5c03ccbd1b1b1a62.zip
Fix ancient bug in parsing of BRE-mode regular expressions.
brenext(), when parsing a '*' quantifier, forgot to return any "value" for the token; per the equivalent case in next(), it should return value 1 to indicate that greedy rather than non-greedy behavior is wanted. The result is that the compiled regexp could behave like 'x*?' rather than the intended 'x*', if we were unlucky enough to have a zero in v->nextvalue at this point. That seems to happen with some reliability if we have '.*' at the beginning of a BRE-mode regexp, although that depends on the initial contents of a stack-allocated struct, so it's not guaranteed to fail. Found by Alexander Lakhin using valgrind testing. This bug seems to be aboriginal in Spencer's code, so back-patch all the way. Discussion: https://postgr.es/m/16814-6c5e3edd2bdf0d50@postgresql.org
Diffstat (limited to 'src/backend/utils/adt/network_gist.c')
0 files changed, 0 insertions, 0 deletions