[pgpool-committers: 6164] pgpool: Fix segfault in certain case.

Tatsuo Ishii ishii at sraoss.co.jp
Mon Sep 16 10:23:35 JST 2019


Fix segfault in certain case.

The scenario is something like:

1) a named statement is created.
2) DEALLOCATE removes it.
3) an erroneous query is executed.

In #2, "sent message" for the named statement is removed but
"uncompleted_message" is left. Then after #3, in ReadyForQuery()
uncompleted_message is added and removed. However, storage for the
uncompleted_message has been already freed in #2, and it causes a
segfault.

Fix is, in SimpleQuery() set NULL to uncompleted_message if it's not
PREPARE command so that ReadyForQuery() does not try to remove the
already removed message.

Per bug 546.

Here is a minimum test case.

'P'     "_plan0x7f2d465db530"   "SELECT 1"      0
'S'
'Y'
'Q'     "DEALLOCATE _plan0x7f2d465db530"
'Y'
'Q'     "CREATE INDEX users_auth_id_index ON non_existing_table ( auth_id )"
'Y'
'X'

Branch
------
V4_1_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=5777465fece05f9af8e40d6f65e2a1ee85ee52b0

Modified Files
--------------
src/protocol/pool_proto_modules.c | 2 ++
1 file changed, 2 insertions(+)



More information about the pgpool-committers mailing list