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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix use-after-free bug with event triggers and ALTER TABLE.
Date: 2020-10-27 19:37:31
Message-ID: E1kXUmh-0003fX-7S@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/41c742a432427177e2ddd6ba434d555f8e6cf02b

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

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2020-10-28 02:08:58 pgsql: Minor improvements in description of spilled counters in pg_stat
Previous Message Tom Lane 2020-10-27 18:31:17 pgsql: Doc: improve explanation of how to use our code coverage infrast