Search code examples
chilkat

Potential crash caused by the syscall 'select' in chilkat lib, in case of socket fd larger than 1024


we are using the chilkat lib on linux x64 to fetch some web resources from internet.noticed that the chilkat lib functions called 'select' to monitor sockets events, from gdb to my program, below functions called 'select':

ChilkatSocket::waitWriteableMsHB(unsigned int, bool, bool, SocketParams&, LogBase&) () ChilkatSocket::waitReadableMsHB(unsigned int, SocketParams&, LogBase&) ()

so it would lead to the FD_SET overflow when the socket fd larger than FD_SETSIZE (1024 on linux), then caused the program crash? is it necessary to use modern syscall 'poll' or 'epoll' instead?

thanks


Solution

  • Chilkat may use the select system call when the fd set is less than FD_SETSIZE. If the fd set is 1024 or greater, it will always use poll. There is no worry of an FD_SET overflow because Chilkat will choose to use "poll" in all cases where it matters.