Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/http_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
#ifndef PHP_WIN32
const double timeoutmax = (double) PHP_TIMEOUT_ULL_MAX / 1000000.0;
#else
const double timeoutmax = (double) LONG_MAX / 1000000.0;
const double timeoutmax = (double) LONG_MAX + 0.999999;
#endif

if (d > timeoutmax) {
Expand Down
8 changes: 8 additions & 0 deletions main/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ static inline void php_network_set_limit_time(struct timeval *limit_time,
struct timeval *timeout)
{
gettimeofday(limit_time, NULL);
# ifdef PHP_WIN32
/* cap timeout (we're not picky regarding usec) */
if (limit_time->tv_sec > (LONG_MAX - timeout->tv_sec) + 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably remove that +1 just in case it gets called with tv_sec 0.

limit_time->tv_sec = LONG_MAX;
limit_time->tv_usec = 999999;
return;
}
# endif
limit_time->tv_sec += timeout->tv_sec;
limit_time->tv_usec += timeout->tv_usec;
if (limit_time->tv_usec >= 1000000) {
Expand Down
Loading