Browse Source

fix possible int overflow

pull/1239/head
Anatol Belski 11 years ago
parent
commit
b9732a37c5
  1. 7
      ext/pdo_pgsql/pgsql_driver.c

7
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);

Loading…
Cancel
Save