raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=16d7b981ebc22df86e4dc7719ae63677bff8b1e1
commit 16d7b981ebc22df86e4dc7719ae63677bff8b1e1 Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com> Date: Fri Apr 4 19:35:16 2014 +0900 ecore-con - deal with internal buffer growing over 2g in size @fix this fixes a corner case where you may buffer 2g or more of data in ecore-con buffers. this leads to a stall. @fix --- src/lib/ecore_con/ecore_con.c | 14 +++++++++----- src/lib/ecore_con/ecore_con_local_win32.c | 4 ++-- src/lib/ecore_con/ecore_con_private.h | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 5813956..bf18feb 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -702,7 +702,8 @@ ecore_con_server_send(Ecore_Con_Server *svr, } #endif } - eina_binbuf_append_length(svr->buf, data, size); + if (!eina_binbuf_append_length(svr->buf, data, size)) + ERR("eina_binbuf_append_length() failed"); return size; } @@ -815,7 +816,8 @@ ecore_con_client_send(Ecore_Con_Client *cl, } #endif } - eina_binbuf_append_length(cl->buf, data, size); + if (!eina_binbuf_append_length(cl->buf, data, size)) + ERR("eina_binbuf_append_length() failed"); } return size; } @@ -2291,9 +2293,10 @@ _ecore_con_svr_cl_handler(void *data, static void _ecore_con_server_flush(Ecore_Con_Server *svr) { - int count, num; + int count; + size_t num; size_t buf_len; - unsigned int *buf_offset; + size_t *buf_offset; const unsigned char *buf; Eina_Binbuf *buf_p; @@ -2400,7 +2403,8 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) static void _ecore_con_client_flush(Ecore_Con_Client *cl) { - int num = 0, count = 0; + int count = 0; + size_t num = 0; if (!cl->fd_handler) return; #ifdef _WIN32 diff --git a/src/lib/ecore_con/ecore_con_local_win32.c b/src/lib/ecore_con/ecore_con_local_win32.c index 670105a..228dd46 100644 --- a/src/lib/ecore_con/ecore_con_local_win32.c +++ b/src/lib/ecore_con/ecore_con_local_win32.c @@ -659,7 +659,7 @@ close_pipe: Eina_Bool ecore_con_local_win32_server_flush(Ecore_Con_Server *svr) { - int num; + size_t num; BOOL res; DWORD written; @@ -706,7 +706,7 @@ Eina_Bool ecore_con_local_win32_client_flush(Ecore_Con_Client *cl) { Ecore_Con_Type type; - int num; + size_t num; BOOL res; DWORD written; diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h index 297162b..d224e2a 100644 --- a/src/lib/ecore_con/ecore_con_private.h +++ b/src/lib/ecore_con/ecore_con_private.h @@ -101,7 +101,7 @@ struct _Ecore_Con_Client Ecore_Con_Server *host_server; void *data; Ecore_Fd_Handler *fd_handler; - unsigned int buf_offset; + size_t buf_offset; Eina_Binbuf *buf; const char *ip; Eina_List *event_count; @@ -136,7 +136,7 @@ struct _Ecore_Con_Server Eina_List *clients; unsigned int client_count; Eina_Binbuf *buf; - unsigned int write_buf_offset; + size_t write_buf_offset; Eina_List *infos; Eina_List *event_count; int client_limit; @@ -146,7 +146,7 @@ struct _Ecore_Con_Server Ecore_Con_Proxy_State ecs_state; int ecs_addrlen; unsigned char ecs_addr[16]; - unsigned int ecs_buf_offset; + size_t ecs_buf_offset; Eina_Binbuf *ecs_buf; Eina_Binbuf *ecs_recvbuf; const char *proxyip; --