changeset 14214:3870f944dec4

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 07 Jun 2026 19:42:39 +0200
parents 55a7143a58ec (current diff) 75d09be04f13 (diff)
children 2719dbb358c8
files
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util-src/poll.c	Fri Jun 05 16:24:55 2026 +0100
+++ b/util-src/poll.c	Sun Jun 07 19:42:39 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));