From b9732a37c5fb075caa009e4dcd9568bca9d2098f Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Apr 2015 16:11:35 +0200 Subject: fix possible int overflow --- ext/pdo_pgsql/pgsql_driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/pdo_pgsql/pgsql_driver.c') diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 8ea8ab248d..1c760dc94b 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -1064,6 +1064,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) if (ms_timeout < 0) { php_error_docref(NULL, E_WARNING, "Invalid timeout"); RETURN_FALSE; +#if ZEND_ENABLE_ZVAL_LONG64 + } else if (ms_timeout > INT_MAX) { + php_error_docref(NULL, E_WARNING, "timeout was shrinked to %d", INT_MAX); + ms_timeout = INT_MAX; +#endif } H = (pdo_pgsql_db_handle *)dbh->driver_data; @@ -1072,7 +1077,7 @@ static PHP_METHOD(PDO, pgsqlGetNotify) pgsql_notify = PQnotifies(H->server); if (ms_timeout && !pgsql_notify) { - php_pollfd_for_ms(PQsocket(H->server), PHP_POLLREADABLE, ms_timeout); + php_pollfd_for_ms(PQsocket(H->server), PHP_POLLREADABLE, (int)ms_timeout); PQconsumeInput(H->server); pgsql_notify = PQnotifies(H->server); -- cgit v1.2.1