postgres/src/backend/commands
Tomas Vondra ce5aaea8cd 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
2023-07-02 22:21:02 +02:00
..
aggregatecmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
alter.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
amcmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
analyze.c Move bool parameter for vacuum_rel() to option bits. 2023-06-20 15:14:58 -07:00
async.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
cluster.c Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHOD 2023-06-30 07:49:01 +09:00
collationcmds.c CREATE DATABASE: make LOCALE apply to all collation providers. 2023-06-16 10:27:32 -07:00
comment.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
constraint.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
conversioncmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
copy.c Improve several permission-related error messages. 2023-03-17 10:33:09 +01:00
copyfrom.c Ignore BRIN indexes when checking for HOT updates 2023-03-20 11:02:42 +01:00
copyfromparse.c Don't try to read default for a non-existent attribute 2023-03-15 17:20:42 -04:00
copyto.c Simplify useless 0L constants 2023-03-29 08:25:12 +02:00
createas.c Simplify useless 0L constants 2023-03-29 08:25:12 +02:00
dbcommands.c CREATE DATABASE: make LOCALE apply to all collation providers. 2023-06-16 10:27:32 -07:00
define.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
discard.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
dropcmds.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
event_trigger.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
explain.c Remove dependency to query text in JumbleQuery() 2023-06-28 08:59:36 +09:00
extension.c Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00
foreigncmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
functioncmds.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
indexcmds.c Fix marking of indisvalid for partitioned indexes at creation 2023-06-30 13:54:48 +09:00
lockcmds.c Fix cache lookup hazards introduced by ff9618e82a. 2023-06-22 15:48:20 -07:00
Makefile Move parallel vacuum code to vacuumparallel.c. 2021-12-23 11:42:52 +05:30
matview.c Revert "Fix search_path to a safe value during maintenance operations." 2023-06-10 08:11:41 -07:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
opclasscmds.c Fix typos in comments 2023-05-02 12:23:08 +09:00
operatorcmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
policy.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
portalcmds.c Simplify useless 0L constants 2023-03-29 08:25:12 +02:00
prepare.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
proclang.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
publicationcmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
schemacmds.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
seclabel.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
sequence.c Convert many uses of ReadBuffer[Extended](P_NEW) to ExtendBufferedRel() 2023-04-05 18:57:29 -07:00
statscmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
subscriptioncmds.c Fix the errhint message and docs for drop subscription failure. 2023-06-21 10:36:09 +05:30
tablecmds.c Ignore invalid indexes when enforcing index rules in ALTER TABLE ATTACH PARTITION 2023-06-28 15:57:31 +09:00
tablespace.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
trigger.c Fix oversight in handling of modifiedCols since f24523672d 2023-07-02 22:21:02 +02:00
tsearchcmds.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
typecmds.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
user.c Error message wording improvements 2023-06-29 09:14:55 +02:00
vacuum.c Fix cache lookup hazards introduced by ff9618e82a. 2023-06-22 15:48:20 -07:00
vacuumparallel.c Fix various typos and incorrect/outdated name references 2023-04-19 13:50:33 +12:00
variable.c Fix outdated references to guc.c 2023-03-02 13:49:39 +01:00
view.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00