pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Catch stack overflow when recursing in transformFromClauseItem()
Date: Sat, 13 Aug 2022 19:21:50 +0000
Message-ID: <E1oMwhh-000dGM-GW@gemulon.postgresql.org> (raw)

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_11_STABLE

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

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



view thread (7+ messages)  latest in thread

Message-ID: <E1oMwhh-000dGM-GW@gemulon.postgresql.org>
Permalink:  ../E1oMwhh-000dGM-GW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oMwhh-000dGM-GW@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Catch stack overflow when recursing in transformFromClauseItem()
  In-Reply-To: <E1oMwhh-000dGM-GW@gemulon.postgresql.org>
  References: <E1oMwhh-000dGM-GW@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox