mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 7.4.1264
Problem: Crash when receiving an empty array. Solution: Check for array with wrong number of arguments. (Damien)
This commit is contained in:
parent
4d919d748e
commit
6076fe1986
@ -688,7 +688,9 @@ channel_parse_json(int ch_idx)
|
|||||||
ret = json_decode(&reader, &listtv);
|
ret = json_decode(&reader, &listtv);
|
||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
if (listtv.v_type != VAR_LIST)
|
/* Only accept the response when it is a list with at least two
|
||||||
|
* items. */
|
||||||
|
if (listtv.v_type != VAR_LIST || listtv.vval.v_list->lv_len < 2)
|
||||||
{
|
{
|
||||||
/* TODO: give error */
|
/* TODO: give error */
|
||||||
clear_tv(&listtv);
|
clear_tv(&listtv);
|
||||||
@ -909,13 +911,6 @@ may_invoke_callback(int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
list = listtv->vval.v_list;
|
list = listtv->vval.v_list;
|
||||||
if (list->lv_len < 2)
|
|
||||||
{
|
|
||||||
/* TODO: give error */
|
|
||||||
clear_tv(listtv);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
argv[1] = list->lv_first->li_next->li_tv;
|
argv[1] = list->lv_first->li_next->li_tv;
|
||||||
typetv = &list->lv_first->li_tv;
|
typetv = &list->lv_first->li_tv;
|
||||||
if (typetv->v_type == VAR_STRING)
|
if (typetv->v_type == VAR_STRING)
|
||||||
|
@ -9874,19 +9874,13 @@ f_ch_sendexpr(typval_T *argvars, typval_T *rettv)
|
|||||||
if (ch_idx >= 0)
|
if (ch_idx >= 0)
|
||||||
{
|
{
|
||||||
if (channel_read_json_block(ch_idx, id, &listtv) == OK)
|
if (channel_read_json_block(ch_idx, id, &listtv) == OK)
|
||||||
{
|
|
||||||
if (listtv->v_type == VAR_LIST)
|
|
||||||
{
|
{
|
||||||
list_T *list = listtv->vval.v_list;
|
list_T *list = listtv->vval.v_list;
|
||||||
|
|
||||||
if (list->lv_len == 2)
|
|
||||||
{
|
|
||||||
/* Move the item from the list and then change the type to
|
/* Move the item from the list and then change the type to
|
||||||
* avoid the value being freed. */
|
* avoid the value being freed. */
|
||||||
*rettv = list->lv_last->li_tv;
|
*rettv = list->lv_last->li_tv;
|
||||||
list->lv_last->li_tv.v_type = VAR_NUMBER;
|
list->lv_last->li_tv.v_type = VAR_NUMBER;
|
||||||
}
|
|
||||||
}
|
|
||||||
clear_tv(listtv);
|
clear_tv(listtv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,11 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
print("sending: {}".format(cmd))
|
print("sending: {}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
|
elif decoded[1] == 'empty-request':
|
||||||
|
cmd = '[]'
|
||||||
|
print("sending: {}".format(cmd))
|
||||||
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
|
response = "ok"
|
||||||
elif decoded[1] == 'eval-result':
|
elif decoded[1] == 'eval-result':
|
||||||
# Send back the last received eval result.
|
# Send back the last received eval result.
|
||||||
response = last_eval
|
response = last_eval
|
||||||
@ -123,11 +128,9 @@ if __name__ == "__main__":
|
|||||||
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
|
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
|
||||||
ip, port = server.server_address
|
ip, port = server.server_address
|
||||||
|
|
||||||
# Start a thread with the server -- that thread will then start one
|
# Start a thread with the server. That thread will then start a new thread
|
||||||
# more thread for each request
|
# for each connection.
|
||||||
server_thread = threading.Thread(target=server.serve_forever)
|
server_thread = threading.Thread(target=server.serve_forever)
|
||||||
|
|
||||||
# Exit the server thread when the main thread terminates
|
|
||||||
server_thread.start()
|
server_thread.start()
|
||||||
|
|
||||||
# Write the port number in Xportnr, so that the test knows it.
|
# Write the port number in Xportnr, so that the test knows it.
|
||||||
|
@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1264,
|
||||||
/**/
|
/**/
|
||||||
1263,
|
1263,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user