postgresql/contrib/pg_stat_statements/expected
Michael Paquier 8268e41aca pg_stat_statements: Fix potential use-after-free of PlannedStmt
pgss_ProcessUtility() included a reference to a portion of a PlannedStmt
after the point where this data's structure could have been freed,
causing an incorrect memory access.  There was a comment documenting
this requirement, missed in 3357471cf9.

This commit includes a test able to make valgrind complain with a
PlannedStmt freed by an internal ROLLBACK query.  Similarly to what is
mentioned in 495e73c207, this can be triggered by using the extended
query protocol, something that can be now tested thanks to the recent
meta-command additions in psql.  This commit mentions potential other
cases, but as far as I can see the extended protocol case with an
internal ROLLBACK is the only problematic pattern reachable in practice.

Issue introduced by 3357471cf9, gone unnoticed due to a lack of test
coverage.  The fix is authored by Chao, my contribution being the new
test.

Author: Chao Li <li.evan.chao@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/2F91906A-F2B5-4A6B-9695-D136957D4545@gmail.com
2026-05-12 13:36:38 +09:00
..
cleanup.out Refactor tests of pg_stat_statements for planning, utility and level tracking 2023-02-20 09:28:29 +09:00
cursors.out Show sizes of FETCH queries as constants in pg_stat_statements 2025-07-02 08:39:25 +09:00
dml.out Remove the query_id_squash_values GUC 2025-03-27 13:33:37 +01:00
entry_timestamp.out Track statement entry timestamp in contrib/pg_stat_statements 2023-11-27 02:52:17 +02:00
extended.out Make query jumbling also squash PARAM_EXTERN params 2025-06-24 19:36:32 +02:00
level_tracking.out plpgsql: optimize "SELECT simple-expression INTO var". 2026-03-20 18:23:45 -04:00
oldextversions.out pg_stat_statements: Add counters for generic and custom plans 2025-07-31 11:37:37 +09:00
parallel.out pg_stat_statements: Add columns to track parallel worker activity 2024-10-09 08:30:45 +09:00
plancache.out pg_stat_statements: Fix potential use-after-free of PlannedStmt 2026-05-12 13:36:38 +09:00
planning.out Revert support for improved tracking of nested queries 2025-06-12 10:08:55 +09:00
privileges.out pg_stat_statements: Add regression test for privilege handling. 2024-07-24 20:54:51 +09:00
select.out Fix query jumbling with GROUP BY clauses 2026-01-14 08:44:12 +09:00
squashing.out pg_stat_statements: Rework test order 2026-01-21 07:47:38 +09:00
user_activity.out Add NOT NULL checking of pg_stat_statements_reset() in tests 2023-11-27 02:52:17 +02:00
utility.out Show sizes of FETCH queries as constants in pg_stat_statements 2025-07-02 08:39:25 +09:00
wal.out Show values of SET statements as constants in pg_stat_statements 2024-09-30 14:02:00 +09:00