From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix use-after-free bug with AfterTriggersTableData.storeslot
Date: Sat, 27 Feb 2021 21:10:37 +0000
Message-ID: <E1lG6rF-0006Oo-FW@gemulon.postgresql.org> (raw)
Fix use-after-free bug with AfterTriggersTableData.storeslot
AfterTriggerSaveEvent() wrongly allocates the slot in execution-span
memory context, whereas the correct thing is to allocate it in
a transaction-span context, because that's where the enclosing
AfterTriggersTableData instance belongs into.
Backpatch to 12 (the test back to 11, where it works well with no code
changes, and it's good to have to confirm that the case was previously
well supported); this bug seems introduced by commit ff11e7f4b9ae.
Reported-by: Bertrand Drouvot <bdrouvot@amazon.com>
Author: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/39a71864-b120-5a5c-8cc5-c632b6f16761@amazon.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/25936fd46c97039aad042ae8d46917d38d132fe4
Modified Files
--------------
src/backend/commands/trigger.c | 52 +++++++++++++++++----------
src/test/regress/expected/triggers.out | 59 ++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql | 65 ++++++++++++++++++++++++++++++++++
3 files changed, 157 insertions(+), 19 deletions(-)
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: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Fix use-after-free bug with AfterTriggersTableData.storeslot
In-Reply-To: <E1lG6rF-0006Oo-FW@gemulon.postgresql.org>
References: <E1lG6rF-0006Oo-FW@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