From 36c5f1026f19b919180ea11a94eb86e7708fed15 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 18 Oct 2019 13:29:01 -0400 Subject: [PATCH] ecore/main: avoid calling FD_SET with invalid fd value Summary: it's possible that _ecore_get_epoll_fd() can return -1, so ensure that we correctly handle this CID 1383850 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10394 --- src/lib/ecore/ecore_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index cdd51209a0..7e84d9d231 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -1825,7 +1825,8 @@ _ecore_main_select(Eo *obj, Efl_Loop_Data *pd, double timeout) { // polling on the epoll fd will wake when fd in the epoll set is active max_fd = _ecore_get_epoll_fd(obj, pd); - FD_SET(max_fd, &rfds); + if (max_fd > -1) + FD_SET(max_fd, &rfds); } #endif EINA_LIST_FOREACH(pd->file_fd_handlers, l, fdh)