diff options
author | Anatol Belski <ab@php.net> | 2015-04-15 16:11:35 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2015-04-15 17:57:27 +0200 |
commit | b9732a37c5fb075caa009e4dcd9568bca9d2098f (patch) | |
tree | 3d33b24a6d7f97158904fb41b020eae7e0a27a66 /ext/pdo_pgsql/pgsql_driver.c | |
parent | 7a88cfe44d205197afe84c43b283e4f7d8c5dccc (diff) | |
download | php-git-b9732a37c5fb075caa009e4dcd9568bca9d2098f.tar.gz |
fix possible int overflow
Diffstat (limited to 'ext/pdo_pgsql/pgsql_driver.c')
-rw-r--r-- | ext/pdo_pgsql/pgsql_driver.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); |