0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.2002

Problem:    Crash when passing number to filter() or map().
Solution:   Convert to a string. (Ozaki Kiichi)
This commit is contained in:
Bram Moolenaar
2016-07-08 20:11:07 +02:00
parent ba768495c2
commit a06ec8f345
3 changed files with 11 additions and 1 deletions

View File

@@ -12044,6 +12044,7 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
{
typval_T rettv;
typval_T argv[3];
char_u buf[NUMBUFLEN];
char_u *s;
int retval = FAIL;
int dummy;
@@ -12051,9 +12052,9 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
copy_tv(tv, &vimvars[VV_VAL].vv_tv);
argv[0] = vimvars[VV_KEY].vv_tv;
argv[1] = vimvars[VV_VAL].vv_tv;
s = expr->vval.v_string;
if (expr->v_type == VAR_FUNC)
{
s = expr->vval.v_string;
if (call_func(s, (int)STRLEN(s),
&rettv, 2, argv, 0L, 0L, &dummy, TRUE, NULL, NULL) == FAIL)
goto theend;
@@ -12070,6 +12071,9 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
}
else
{
s = get_tv_string_buf_chk(expr, buf);
if (s == NULL)
goto theend;
s = skipwhite(s);
if (eval1(&s, &rettv, TRUE) == FAIL)
goto theend;