From: José Bollo Date: Mon, 26 Aug 2013 10:06:37 +0000 (+0200) Subject: Fix a bug when fd is negative (what is possible --see poll man page--) X-Git-Tag: accepted/tizen/20130926.225126~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac217d73a32a7da15bfcd448991119c6b290d510;p=platform%2Fupstream%2Fecore.git Fix a bug when fd is negative (what is possible --see poll man page--) --- 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)) {