You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9398932
Browse filesBrowse the repository at this point in the historyBrowse files
Windows: grow stream_select() fd_set on demand and cap handle count
On Windows the winsock fd_set is a packed array of SOCKETs bounded by the
compile-time FD_SETSIZE, so stream_select() silently dropped sockets past
that limit. Replace the fixed fd_set on the socket path with a growable
{capacity; fd_set} that doubles via realloc, giving parity with POSIX for
socket-heavy code. FD_ISSET/FD_ZERO/select() only read fd_count, so the
grown set is passed to them unchanged; php_select()'s internal working
sets grow too and the struct-assignment copies become memcpy. The POSIX
fd_bigset path and php_select()'s fd_set* ABI are unchanged.
Also cap the non-socket (pipe/file) handle path at MAXIMUM_WAIT_OBJECTS
(64) inside php_select() itself: it previously pushed each handle into a
fixed 64-entry stack array with no bound, crashing the process with a
stack buffer overrun (STATUS_STACK_BUFFER_OVERRUN) when given 65+ pipe or
file handles. It now returns an error so the caller reports a warning and
false. Fixing it in php_select() also protects the direct caller in
sapi/cli/php_cli_server.c.
Adds two Windows-only phpt tests: one selecting on more than FD_SETSIZE
sockets, and one asserting 65+ handles fail gracefully instead of
crashing.
0 commit comments