devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=79277d1cb48f750b44b8e9dc35c10433187eebd2
commit 79277d1cb48f750b44b8e9dc35c10433187eebd2 Author: Chris Michael <cpmich...@osg.samsung.com> Date: Thu Jun 30 11:07:09 2016 -0400 ecore-wl2: Fix issue of passing negative number to close() and read() We should be checking the return value of ecore_main_fd_handler_fd_get calls as they can return a negative number...which cannot be passed to the close() or read() functions. Fixes Coverity CID1357152 and CID1357153 @fix Signed-off-by: Chris Michael <cpmich...@osg.samsung.com> --- src/lib/ecore_wl2/ecore_wl2_dnd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c b/src/lib/ecore_wl2/ecore_wl2_dnd.c index b885356..b696a2d 100644 --- a/src/lib/ecore_wl2/ecore_wl2_dnd.c +++ b/src/lib/ecore_wl2/ecore_wl2_dnd.c @@ -223,13 +223,15 @@ _selection_data_ready_cb_free(void *data EINA_UNUSED, void *event) static Eina_Bool _selection_data_read(void *data, Ecore_Fd_Handler *fdh) { - int len; + int len, fd; char buffer[PATH_MAX]; Ecore_Wl2_Dnd_Source *source = data; Ecore_Wl2_Event_Selection_Data_Ready *event; Eina_Bool ret; - len = read(ecore_main_fd_handler_fd_get(fdh), buffer, sizeof buffer); + fd = ecore_main_fd_handler_fd_get(fdh); + if (fd >= 0) + len = read(fd, buffer, sizeof buffer); event = calloc(1, sizeof(Ecore_Wl2_Event_Selection_Data_Ready)); if (!event) return ECORE_CALLBACK_CANCEL; @@ -243,7 +245,9 @@ _selection_data_read(void *data, Ecore_Fd_Handler *fdh) WL_DATA_OFFER_FINISH_SINCE_VERSION) wl_data_offer_finish(source->offer); } - close(ecore_main_fd_handler_fd_get(source->fdh)); + + fd = ecore_main_fd_handler_fd_get(source->fdh); + if (fd >= 0) close(fd); ecore_main_fd_handler_del(source->fdh); source->fdh = NULL; --