summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSATO Kentaro <kentaro@ranvis.com>2019-12-18 02:16:55 +0900
committerNikita Popov <nikita.ppv@gmail.com>2019-12-20 11:44:07 +0100
commit7e39e6934d7eb3f480a467de7d9fbca608fc1e94 (patch)
treed3871d2264f97b63b55b422d24563938103e506d
parentc62cd9a43ad97aa279615b21f7cb5f1646f52d80 (diff)
downloadphp-git-7e39e6934d7eb3f480a467de7d9fbca608fc1e94.tar.gz
Fix #78980: pgsqlGetNotify() overlooks dead connection
pgsqlGetNotify() didn't check result of PQconsumeInput().
-rw-r--r--NEWS2
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index b178b9ddb8..e38899f70e 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@ PHP NEWS
- PDO_PgSQL:
. Fixed bug #78983 (pdo_pgsql config.w32 cannot find libpq-fe.h). (SATŌ
Kentarō)
+ . Fixed bug #78980 (pgsqlGetNotify() overlooks dead connection). (SATŌ
+ Kentarō)
18 Dec 2019, PHP 7.3.13
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 64be3cd9b8..1be0a6146e 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -1071,13 +1071,21 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
H = (pdo_pgsql_db_handle *)dbh->driver_data;
- PQconsumeInput(H->server);
+ if (!PQconsumeInput(H->server)) {
+ pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
+ PDO_HANDLE_DBH_ERR();
+ RETURN_FALSE;
+ }
pgsql_notify = PQnotifies(H->server);
if (ms_timeout && !pgsql_notify) {
php_pollfd_for_ms(PQsocket(H->server), PHP_POLLREADABLE, (int)ms_timeout);
- PQconsumeInput(H->server);
+ if (!PQconsumeInput(H->server)) {
+ pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
+ PDO_HANDLE_DBH_ERR();
+ RETURN_FALSE;
+ }
pgsql_notify = PQnotifies(H->server);
}