pgsql: Check stack depth in new recursive functions

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check stack depth in new recursive functions
Date: 2023-11-08 17:46:07
Message-ID: E1r0mcx-004ViU-DN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Check stack depth in new recursive functions

Commit b0e96f311985 introduced a bunch of recursive functions, but
failed to make them check for stack depth. This can cause the backend
to crash when operating on inheritance hierarchies several thousands
deep. Protect the code by adding the missing stack depth checks.

Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Discussion: https://postgr.es/m/b2ac2392-9727-5f76-e890-721ac80c1615@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b0f7dd915bca6243f3daf52a81b8d0682a38ee3b

Modified Files
--------------
src/backend/commands/tablecmds.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2023-11-08 21:05:05 pgsql: doc: mention that ANALYZE does block DDL
Previous Message Tom Lane 2023-11-08 17:01:44 pgsql: Fix some issues with tracking nesting level in pg_stat_statement