Skip to content

Commit

Permalink
Fix crashes on large numbers of connections (#843)
Browse files Browse the repository at this point in the history
All three fd_set arguments to select must be large enough to modify
according to the length given in the first argument to select. This can
be done by calling rb_fd_resize on each of the fd_set arguments, which
happens to be exactly what rb_fd_select does!
  • Loading branch information
sodabrew authored May 6, 2018
1 parent 159ad95 commit 3440de4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ _SelectDataSelect
static VALUE _SelectDataSelect (void *v)
{
SelectData_t *sd = (SelectData_t*)v;
sd->nSockets = select (sd->maxsocket+1, rb_fd_ptr(&(sd->fdreads)), rb_fd_ptr(&(sd->fdwrites)), rb_fd_ptr(&(sd->fderrors)), &(sd->tv));
sd->nSockets = rb_fd_select (sd->maxsocket+1, &(sd->fdreads), &(sd->fdwrites), &(sd->fderrors), &(sd->tv));
return Qnil;
}
#endif
Expand Down

0 comments on commit 3440de4

Please sign in to comment.