postgresql/src/test/modules/test_extensions
Alvaro Herrera ced138e8cb
Fix use-after-free bug with event triggers in an extension script
ALTER TABLE commands in an extension script are added to an event
trigger command list; but starting with commit b5810de3f4 they do so in
a memory context that's too short-lived, so when execution ends and time
comes to use the entries, they've already been freed.

(This would also be a problem with ALTER TABLE commands in a
multi-command query string, but these serendipitously end in
PortalContext -- which probably explains why it took so long for this to
be reported.)

Fix by using the memory context specifically set for that, instead.

Backpatch to 13, where the aforementioned commit appeared.

Reported-by: Philippe Beaudoin
Author: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Discussion: https://postgr.es/m/20200902193715.6e0269d4@firost
2020-09-15 21:03:14 -03:00
..
expected Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
sql Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
.gitignore Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
Makefile Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
test_ext1--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext1.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext2--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext2.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext3--1.0.sql Ensure commands in extension scripts see the results of preceding DDL. 2017-05-02 18:06:09 -04:00
test_ext3.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext4--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext4.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext5--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext5.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext6--1.0.sql In recordExtensionInitPriv(), keep the scan til we're done with it 2016-04-15 21:57:15 -04:00
test_ext6.control In recordExtensionInitPriv(), keep the scan til we're done with it 2016-04-15 21:57:15 -04:00
test_ext7--1.0--2.0.sql Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
test_ext7--1.0.sql Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
test_ext7.control Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
test_ext8--1.0.sql Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
test_ext8.control Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
test_ext_cyclic1--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_cyclic1.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_cyclic2--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_cyclic2.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_evttrig--1.0--2.0.sql Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
test_ext_evttrig--1.0.sql Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
test_ext_evttrig.control Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00