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 in3357471cf9. This commit includes a test able to make valgrind complain with a PlannedStmt freed by an internal ROLLBACK query. Similarly to what is mentioned in495e73c207, 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 by3357471cf9, 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
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.