summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-04-04 19:35:16 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-04-04 19:36:25 +0900
commit99fb2666ab1b88278026a83cc602a2a1c2775733 (patch)
tree045b06e58b05d8fcfe59beeea1fa306e37f0b038
parentf8fbb5abc29e84f313cb0305d004e08bcdae1bb4 (diff)
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
-rw-r--r--src/lib/ecore_con/ecore_con.c14
-rw-r--r--src/lib/ecore_con/ecore_con_local_win32.c4
-rw-r--r--src/lib/ecore_con/ecore_con_private.h6
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 5813956ed5..bf18febfc3 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,
702 } 702 }
703#endif 703#endif
704 } 704 }
705 eina_binbuf_append_length(svr->buf, data, size); 705 if (!eina_binbuf_append_length(svr->buf, data, size))
706 ERR("eina_binbuf_append_length() failed");
706 707
707 return size; 708 return size;
708} 709}
@@ -815,7 +816,8 @@ ecore_con_client_send(Ecore_Con_Client *cl,
815 } 816 }
816#endif 817#endif
817 } 818 }
818 eina_binbuf_append_length(cl->buf, data, size); 819 if (!eina_binbuf_append_length(cl->buf, data, size))
820 ERR("eina_binbuf_append_length() failed");
819 } 821 }
820 return size; 822 return size;
821} 823}
@@ -2291,9 +2293,10 @@ _ecore_con_svr_cl_handler(void *data,
2291static void 2293static void
2292_ecore_con_server_flush(Ecore_Con_Server *svr) 2294_ecore_con_server_flush(Ecore_Con_Server *svr)
2293{ 2295{
2294 int count, num; 2296 int count;
2297 size_t num;
2295 size_t buf_len; 2298 size_t buf_len;
2296 unsigned int *buf_offset; 2299 size_t *buf_offset;
2297 const unsigned char *buf; 2300 const unsigned char *buf;
2298 Eina_Binbuf *buf_p; 2301 Eina_Binbuf *buf_p;
2299 2302
@@ -2400,7 +2403,8 @@ _ecore_con_server_flush(Ecore_Con_Server *svr)
2400static void 2403static void
2401_ecore_con_client_flush(Ecore_Con_Client *cl) 2404_ecore_con_client_flush(Ecore_Con_Client *cl)
2402{ 2405{
2403 int num = 0, count = 0; 2406 int count = 0;
2407 size_t num = 0;
2404 2408
2405 if (!cl->fd_handler) return; 2409 if (!cl->fd_handler) return;
2406#ifdef _WIN32 2410#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 670105ae31..228dd4643f 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:
659Eina_Bool 659Eina_Bool
660ecore_con_local_win32_server_flush(Ecore_Con_Server *svr) 660ecore_con_local_win32_server_flush(Ecore_Con_Server *svr)
661{ 661{
662 int num; 662 size_t num;
663 BOOL res; 663 BOOL res;
664 DWORD written; 664 DWORD written;
665 665
@@ -706,7 +706,7 @@ Eina_Bool
706ecore_con_local_win32_client_flush(Ecore_Con_Client *cl) 706ecore_con_local_win32_client_flush(Ecore_Con_Client *cl)
707{ 707{
708 Ecore_Con_Type type; 708 Ecore_Con_Type type;
709 int num; 709 size_t num;
710 BOOL res; 710 BOOL res;
711 DWORD written; 711 DWORD written;
712 712
diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h
index 297162bb63..d224e2a385 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
101 Ecore_Con_Server *host_server; 101 Ecore_Con_Server *host_server;
102 void *data; 102 void *data;
103 Ecore_Fd_Handler *fd_handler; 103 Ecore_Fd_Handler *fd_handler;
104 unsigned int buf_offset; 104 size_t buf_offset;
105 Eina_Binbuf *buf; 105 Eina_Binbuf *buf;
106 const char *ip; 106 const char *ip;
107 Eina_List *event_count; 107 Eina_List *event_count;
@@ -136,7 +136,7 @@ struct _Ecore_Con_Server
136 Eina_List *clients; 136 Eina_List *clients;
137 unsigned int client_count; 137 unsigned int client_count;
138 Eina_Binbuf *buf; 138 Eina_Binbuf *buf;
139 unsigned int write_buf_offset; 139 size_t write_buf_offset;
140 Eina_List *infos; 140 Eina_List *infos;
141 Eina_List *event_count; 141 Eina_List *event_count;
142 int client_limit; 142 int client_limit;
@@ -146,7 +146,7 @@ struct _Ecore_Con_Server
146 Ecore_Con_Proxy_State ecs_state; 146 Ecore_Con_Proxy_State ecs_state;
147 int ecs_addrlen; 147 int ecs_addrlen;
148 unsigned char ecs_addr[16]; 148 unsigned char ecs_addr[16];
149 unsigned int ecs_buf_offset; 149 size_t ecs_buf_offset;
150 Eina_Binbuf *ecs_buf; 150 Eina_Binbuf *ecs_buf;
151 Eina_Binbuf *ecs_recvbuf; 151 Eina_Binbuf *ecs_recvbuf;
152 const char *proxyip; 152 const char *proxyip;