]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Check for interrupts and stack overflow in TParserGet().
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 24 Jun 2023 21:18:08 +0000 (17:18 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 24 Jun 2023 21:18:08 +0000 (17:18 -0400)
commita77d901714416f6bd4343c367585b060f385bbbc
treeca6c5176e8d34e1349f50c222b3688c76304c77f
parentf08faee4b94504e30b21ce85bda459f6e5281145
Check for interrupts and stack overflow in TParserGet().

TParserGet() recurses for some token types, meaning it's possible
to drive it to stack overflow.  Since this is a minority behavior,
I chose to add the check_stack_depth() call to the two places that
recurse rather than doing it during every single call.

While at it, add CHECK_FOR_INTERRUPTS(), because this can run
unpleasantly long for long inputs.

Per bug #17995 from Zuming Jiang.  This is old, so back-patch
to all supported branches.

Discussion: https://postgr.es/m/17995-9f20ff3e6389db4c@postgresql.org
src/backend/tsearch/wparser_def.c