Changeset

7602:a4d5eec36a17

net.server_epoll: Prevent invalid FDs from being added to epoll
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2016 17:16:21 +0200
parents 7601:ce20546d7714
children 7603:4e2b019ff176
files net/server_epoll.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Thu Aug 18 17:15:52 2016 +0200
+++ b/net/server_epoll.lua	Thu Aug 18 17:16:21 2016 +0200
@@ -246,6 +246,10 @@
 		return true;
 	end
 	local fd = self:getfd();
+	if fd < 0 then
+		self._wantread, self._wantwrite = nil, nil;
+		return nil, "invalid fd";
+	end
 	local op = "mod";
 	if not flags then
 		op = "del";