Commit b0316cdb authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by Austin Seipp

reading/writing blocking FDs over FD_SETSIZE is broken (Partially Trac #9169)

libraries/base/cbits/inputReady.c had no limits on file descriptors.
Add a limit as non-threaded RTS does.
Signed-off-by: default avatarSergei Trofimovich <>

Test Plan: none

Reviewers: austin, simonmar

Reviewed By: austin, simonmar

Subscribers: simonmar, relrod, carter

Differential Revision:
parent 34f7e9a3
......@@ -25,7 +25,11 @@ fdReady(int fd, int write, int msecs, int isSock)
int maxfd, ready;
fd_set rfd, wfd;
struct timeval tv;
if ((fd >= (int)FD_SETSIZE) || (fd < 0)) {
/* avoid memory corruption on too large FDs */
errno = EINVAL;
return -1;
if (write) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment