pgsql: Fix oversight in handling of modifiedCols since f24523672d

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема pgsql: Fix oversight in handling of modifiedCols since f24523672d
Дата
Msg-id E1qG3aj-001a8l-Dg@gemulon.postgresql.org
обсуждение исходный текст
Список 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_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9cf85093b55979e7d8ccfd9d0da21ce277a2f321

Modified Files
--------------
src/backend/commands/trigger.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: pgsql: Fix oversight in handling of modifiedCols since f24523672d
Следующее
От: Tomas Vondra
Дата:
Сообщение: pgsql: Fix oversight in handling of modifiedCols since f24523672d