Skip to content

Commit fd4db3e

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 708d8e9 + 987a3a5 commit fd4db3e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. Fixed bug GH-19245 (Success error message on TLS stream accept failure).
1111
(Jakub Zelenka)
1212

13+
- PGSQL:
14+
. Fixed bug GH-19485 (potential use after free when using persistent pgsql
15+
connections). (Mark Karpeles)
16+
1317
- Standard:
1418
. Fixed bug GH-16649 (UAF during array_splice). (alexandre-daubois)
1519

ext/pgsql/pgsql.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ static void _close_pgsql_plink(zend_resource *rsrc)
320320

321321
static void _php_pgsql_notice_handler(void *l, const char *message)
322322
{
323+
if (l == NULL) {
324+
/* This connection does not currently have a valid context, ignore this notice */
325+
return;
326+
}
323327
if (PGG(ignore_notices)) {
324328
return;
325329
}
@@ -352,6 +356,11 @@ static int _rollback_transactions(zval *el)
352356

353357
link = (PGconn *) rsrc->ptr;
354358

359+
/* unset notice processor if we initially did set it */
360+
if (PQsetNoticeProcessor(link, NULL, NULL) == _php_pgsql_notice_handler) {
361+
PQsetNoticeProcessor(link, _php_pgsql_notice_handler, NULL);
362+
}
363+
355364
if (PQsetnonblocking(link, 0)) {
356365
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
357366
return -1;

0 commit comments

Comments
 (0)