pgsql: Check for interrupts and stack overflow in TParserGet().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check for interrupts and stack overflow in TParserGet().
Date: 2023-06-24 21:18:24
Message-ID: E1qDAeH-000FLU-4L@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/691594acd67e68d903ea1b7575a7a9097772bbcb

Modified Files
--------------
src/backend/tsearch/wparser_def.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-06-24 21:18:25 pgsql: Check for interrupts and stack overflow in TParserGet().
Previous Message Michael Paquier 2023-06-24 11:31:28 pgsql: Define OPENSSL_API_COMPAT