Interesting new class of bugs I need to write about and report: select requires pointers to objects of type fd_set, but some programs including OpenSSH pass it a pointer to malloc'd memory sized only for nfds, not sizeof(fd_set).
If you really want to *try* using higher numbers and hope it works, you really need to allocate an array of fd_set objects (rounded up to whole objects) rather than partial ones, and apply the FD_*() macros to the right element of the array. But there's no guarantee it'll work.
-
-
What layer of the stack defines this as UB? A while back a friend and I looked at this and confirmed that most "traditional Unix-like or inspired" (Linux, macOS, and some BSDs) just use bitfields of various shapes for fd_set and work just fine with larger/smaller ones.
-
Violation of a "shall" in the description of select's interface contract.
-
Note that there's no specification of the layout/order of bits in the fd_set so the low bits could be at the end of it.
-
I know this part. We were making syscalls directly and had slightly different codepaths for all the platforms we supported.
-
The syscall APIs are not the same as the Posix APIs.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.