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-after-free bug with event triggers and ALTER TABLE.
Date: Tue, 27 Oct 2020 19:37:31 +0000
Message-ID: <E1kXUmh-0003fd-8P@gemulon.postgresql.org> (raw)

Fix use-after-free bug with event triggers and ALTER TABLE.

EventTriggerAlterTableEnd neglected to make sure that it built its
output list in the right context.  In simple cases this was masked
because the function is called in PortalContext which will be
sufficiently long-lived anyway; but that doesn't make it not a bug.
Commit ced138e8c fixed this in HEAD and v13, but mistakenly chose
not to back-patch further.  Back-patch the same code change all
the way (I didn't bother with the test case though, as it would
prove nothing in pre-v13 branches).

Per report from Arseny Sher.
Original fix by Jehan-Guillaume de Rorthais.

Discussion: https://postgr.es/m/877drcyprb.fsf@ars-thinkpad
Discussion: https://postgr.es/m/20200902193715.6e0269d4@firost

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7978ad025478e1c6f3a60ee95d6ebefe7f263841

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



view thread (7+ messages)  latest in thread

Message-ID: <E1kXUmh-0003fd-8P@gemulon.postgresql.org>
Permalink:  ../E1kXUmh-0003fd-8P@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kXUmh-0003fd-8P@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-after-free bug with event triggers and ALTER TABLE.
  In-Reply-To: <E1kXUmh-0003fd-8P@gemulon.postgresql.org>
  References: <E1kXUmh-0003fd-8P@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