From c7a86a38a3f657ab81163ac794450fc7ada2ba3c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 10 Apr 2019 12:18:57 +0200 Subject: Fix pgsql use after free trying to reuse closed connection When a connection is closed, we also need to remove the hash entry from the regular_list, as it now points to freed memory. To do this store a reverse mapping from the connection to the hash string. It would be nicer to introduce a wrapping structure for the pgsql link resource that could store the hash (and notices), but that would require large changes to the extension, so I'm going for a more minimal fix here. --- ext/pgsql/tests/connect_after_close.phpt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ext/pgsql/tests/connect_after_close.phpt (limited to 'ext/pgsql/tests') diff --git a/ext/pgsql/tests/connect_after_close.phpt b/ext/pgsql/tests/connect_after_close.phpt new file mode 100644 index 0000000000..65f954570b --- /dev/null +++ b/ext/pgsql/tests/connect_after_close.phpt @@ -0,0 +1,19 @@ +--TEST-- +Reopen connection after it was closed +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +bool(true) -- cgit v1.2.1