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: Fix use of uninitialized variable in inline_function().
Date: Tue, 25 May 2021 16:56:08 +0000
Message-ID: <E1llaLg-0002fP-6y@gemulon.postgresql.org> (raw)

Fix use of uninitialized variable in inline_function().

Commit e717a9a18 introduced a code path that bypassed the call of
get_expr_result_type, which is not good because we need its rettupdesc
result to pass to check_sql_fn_retval.  We'd failed to notice right
away because the code path in which check_sql_fn_retval uses that
argument is fairly hard to reach in this context.  It's not impossible
though, and in any case inline_function would have no business
assuming that check_sql_fn_retval doesn't need that value.

To fix, move get_expr_result_type out of the if-block, which in
turn requires moving the construction of the dummy FuncExpr
out of it.

Per report from Ranier Vilela.  (I'm bemused by the lack of any
compiler complaints...)

Discussion: https://postgr.es/m/CAEudQAqBqQpQ3HruWAGU_7WaMJ7tntpk0T8k_dVtNB46DqdBgw@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/util/clauses.c | 44 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 22 deletions(-)



Message-ID: <E1llaLg-0002fP-6y@gemulon.postgresql.org>
Permalink:  ../E1llaLg-0002fP-6y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1llaLg-0002fP-6y@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: Fix use of uninitialized variable in inline_function().
  In-Reply-To: <E1llaLg-0002fP-6y@gemulon.postgresql.org>
  References: <E1llaLg-0002fP-6y@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