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
This commit is contained in:
Carsten Haitzler 2014-04-04 19:35:16 +09:00
parent deb8a637e4
commit 16d7b981eb
3 changed files with 14 additions and 10 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;