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: Avoid possible longjmp-induced logic error in PLy_trigger_build_
Date: Mon, 01 Apr 2024 19:15:21 +0000
Message-ID: <E1rrN7o-0001PQ-QQ@gemulon.postgresql.org> (raw)

Avoid possible longjmp-induced logic error in PLy_trigger_build_args.

The "pltargs" variable wasn't marked volatile, which makes it unsafe
to change its value within the PG_TRY block.  It looks like the worst
outcome would be to fail to release a refcount on Py_None during an
(improbable) error exit, which would likely go unnoticed in the field.
Still, it's a bug.  A one-liner fix could be to mark pltargs volatile,
but on the whole it seems cleaner to arrange things so that we don't
change its value within PG_TRY.

Per report from Xing Guo.  This has been there for quite awhile,
so back-patch to all supported branches.

Discussion: https://postgr.es/m/CACpMh+DLrk=fDv07MNpBT4J413fDAm+gmMXgi8cjPONE+jvzuw@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/30fe8a7ba07efc84caba06bce536c0a273ef5655

Modified Files
--------------
src/pl/plpython/plpy_exec.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1rrN7o-0001PQ-QQ@gemulon.postgresql.org>
Permalink:  ../E1rrN7o-0001PQ-QQ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rrN7o-0001PQ-QQ@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid possible longjmp-induced logic error in PLy_trigger_build_
  In-Reply-To: <E1rrN7o-0001PQ-QQ@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