From ac217d73a32a7da15bfcd448991119c6b290d510 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Mon, 26 Aug 2013 12:06:37 +0200 Subject: [PATCH] Fix a bug when fd is negative (what is possible --see poll man page--) --- src/lib/ecore/ecore_glib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/ecore/ecore_glib.c b/src/lib/ecore/ecore_glib.c index a4db0ab..063e0a0 100644 --- a/src/lib/ecore/ecore_glib.c +++ b/src/lib/ecore/ecore_glib.c @@ -84,6 +84,10 @@ _ecore_glib_context_poll_from(const GPollFD *pfds, for (; itr < itr_end; itr++) { + /* ignore invalid values (mainly negative ones) */ + if (itr->fd <0 || itr->fd >= FD_SETSIZE) + continue; + if (glib_fds < itr->fd) glib_fds = itr->fd; @@ -110,6 +114,10 @@ _ecore_glib_context_poll_to(GPollFD *pfds, for (; (itr < itr_end) && (ready > 0); itr++) { + /* ignore invalid values (mainly negative ones) */ + if (itr->fd <0 || itr->fd >= FD_SETSIZE) + continue; + itr->revents = 0; if (FD_ISSET(itr->fd, rfds) && (itr->events & G_IO_IN)) { -- 2.7.4