diff options
author | SATO Kentaro <kentaro@ranvis.com> | 2019-12-18 02:16:55 +0900 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-20 11:44:07 +0100 |
commit | 7e39e6934d7eb3f480a467de7d9fbca608fc1e94 (patch) | |
tree | d3871d2264f97b63b55b422d24563938103e506d /ext/pdo_pgsql | |
parent | c62cd9a43ad97aa279615b21f7cb5f1646f52d80 (diff) | |
download | php-git-7e39e6934d7eb3f480a467de7d9fbca608fc1e94.tar.gz |
Fix #78980: pgsqlGetNotify() overlooks dead connection
pgsqlGetNotify() didn't check result of PQconsumeInput().
Diffstat (limited to 'ext/pdo_pgsql')
-rw-r--r-- | ext/pdo_pgsql/pgsql_driver.c | 12 |
1 files changed, 10 insertions, 2 deletions
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); } |