pgsql: Catch stack overflow when recursing in transformFromClauseItem()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Catch stack overflow when recursing in transformFromClauseItem()
Date: 2022-08-13 19:21:50
Message-ID: E1oMwhh-000dGG-FV@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Catch stack overflow when recursing in transformFromClauseItem().

Most parts of the parser can expect that the stack overflow check
in transformExprRecurse() will trigger before things get desperate.
However, transformFromClauseItem() can recurse directly to self
without having analyzed any expressions, so it's possible to drive
it to a stack-overrun crash. Add a check to prevent that.

Per bug #17583 from Egor Chindyaskin. Back-patch to all supported
branches.

Richard Guo

Discussion: https://postgr.es/m/17583-33be55b9f981f75c@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/60f876317efc7b9ad624b11ae2f4b8208e408ef4

Modified Files
--------------
src/backend/parser/parse_clause.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2022-08-13 20:50:06 Re: [HACKERS] [COMMITTERS] pgsql: Improve performance of SendRowDescriptionMessage.
Previous Message Andres Freund 2022-08-13 19:08:43 Re: [HACKERS] [COMMITTERS] pgsql: Improve performance of SendRowDescriptionMessage.