mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-19484 i: potential use after free when using persistent pgsql connections.
Some checks are pending
Push / MACOS_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Some checks are pending
Push / MACOS_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / FREEBSD (push) Has been skipped
By setting the notice processor to a no-op when a persistent connection is cleaned for future use. Close GH-19485
This commit is contained in:
parent
a3de2ce9ba
commit
987a3a5c8e
2 changed files with 13 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -10,6 +10,10 @@ PHP NEWS
|
||||||
. Fixed bug GH-19245 (Success error message on TLS stream accept failure).
|
. Fixed bug GH-19245 (Success error message on TLS stream accept failure).
|
||||||
(Jakub Zelenka)
|
(Jakub Zelenka)
|
||||||
|
|
||||||
|
- PGSQL:
|
||||||
|
. Fixed bug GH-19485 (potential use after free when using persistent pgsql
|
||||||
|
connections). (Mark Karpeles)
|
||||||
|
|
||||||
- Standard:
|
- Standard:
|
||||||
. Fixed bug GH-16649 (UAF during array_splice). (alexandre-daubois)
|
. Fixed bug GH-16649 (UAF during array_splice). (alexandre-daubois)
|
||||||
|
|
||||||
|
|
|
@ -328,6 +328,10 @@ static void _close_pgsql_plink(zend_resource *rsrc)
|
||||||
|
|
||||||
static void _php_pgsql_notice_handler(void *l, const char *message)
|
static void _php_pgsql_notice_handler(void *l, const char *message)
|
||||||
{
|
{
|
||||||
|
if (l == NULL) {
|
||||||
|
/* This connection does not currently have a valid context, ignore this notice */
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (PGG(ignore_notices)) {
|
if (PGG(ignore_notices)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -360,6 +364,11 @@ static int _rollback_transactions(zval *el)
|
||||||
|
|
||||||
link = (PGconn *) rsrc->ptr;
|
link = (PGconn *) rsrc->ptr;
|
||||||
|
|
||||||
|
/* unset notice processor if we initially did set it */
|
||||||
|
if (PQsetNoticeProcessor(link, NULL, NULL) == _php_pgsql_notice_handler) {
|
||||||
|
PQsetNoticeProcessor(link, _php_pgsql_notice_handler, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (PQsetnonblocking(link, 0)) {
|
if (PQsetnonblocking(link, 0)) {
|
||||||
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
|
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue