]> granicus.if.org Git - php/commit
Fix pgsql use after free trying to reuse closed connection
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Apr 2019 10:18:57 +0000 (12:18 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Apr 2019 10:18:57 +0000 (12:18 +0200)
commitc7a86a38a3f657ab81163ac794450fc7ada2ba3c
tree9c09ee675977102b894cea4d0465dc2e5a611d27
parentb55715d61a908f7732d5a2bb6b20a105f372014a
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.
Zend/zend_hash.c
ext/pgsql/pgsql.c
ext/pgsql/php_pgsql.h
ext/pgsql/tests/connect_after_close.phpt [new file with mode: 0644]