From: | Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix oversight in handling of modifiedCols since f24523672d |
Date: | 2023-07-02 20:22:58 |
Message-ID: | E1qG3b0-001a9M-Tg@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix oversight in handling of modifiedCols since f24523672d
Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap
into the per-row memory context. In the case of AFTER UPDATE triggers,
the bitmap is however referenced from an event kept until the end of the
query, resulting in a use-after-free bug.
Fixed by copying the bitmap into the AfterTriggerEvents memory context,
which is the one where we keep the trigger events. There's only one
place that needs to do the copy, but the memory context may not exist
yet. Doing that in a separate function seems more readable.
Report by Alexander Pyhalov, fix by me. Backpatch to 13, where the
bitmap was added to the event by commit 71d60e2aa0.
Reported-by: Alexander Pyhalov
Backpatch-through: 13
Discussion: https://postgr.es/m/acddb17c89b0d6cb940eaeda18c08bbe@postgrespro.ru
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/7ae4e786892f45af4ded23c94a26537a4b11a4c7
Modified Files
--------------
src/backend/commands/trigger.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2023-07-02 20:23:12 | pgsql: Fix oversight in handling of modifiedCols since f24523672d |
Previous Message | Tomas Vondra | 2023-07-02 20:22:41 | pgsql: Fix oversight in handling of modifiedCols since f24523672d |