# HG changeset patch # User Kim Alvefur # Date 1780221082 -7200 # Node ID 75d09be04f130bd513a59f10ae2d736cd7141a79 # Parent c4aa9b2b4787b54602f0c12012159b3851ead714 util.poll: Reject file descriptors outside of FD_SETSIZE in all methods To prevent accesses outside the bounds of the FD sets. Previously only checked on the write, but maybe this could potentially cause weird behavior as well? diff -r c4aa9b2b4787 -r 75d09be04f13 util-src/poll.c --- a/util-src/poll.c Sat May 30 19:21:08 2026 +0200 +++ b/util-src/poll.c Sun May 31 11:51:22 2026 +0200 @@ -234,6 +234,13 @@ #endif #ifdef USE_SELECT + if(fd >= FD_SETSIZE) { + luaL_pushfail(L); + lua_pushstring(L, strerror(EBADF)); + lua_pushinteger(L, EBADF); + return 3; + } + if(!FD_ISSET(fd, &state->all)) { luaL_pushfail(L); lua_pushstring(L, strerror(ENOENT)); @@ -327,6 +334,13 @@ #endif #ifdef USE_SELECT + if(fd >= FD_SETSIZE) { + luaL_pushfail(L); + lua_pushstring(L, strerror(EBADF)); + lua_pushinteger(L, EBADF); + return 3; + } + if(!FD_ISSET(fd, &state->all)) { luaL_pushfail(L); lua_pushstring(L, strerror(ENOENT));