diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-08 20:11:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-08 20:11:07 +0200 |
commit | a06ec8f345eabb66e5b7d7c0192cfebdde63115d (patch) | |
tree | c6d2b5213c112e772c1f48b9978909660fe0ada7 /src/eval.c | |
parent | ba768495c2e6bae74e49d22d489fbf211ecad55e (diff) | |
download | vim-git-a06ec8f345eabb66e5b7d7c0192cfebdde63115d.tar.gz |
patch 7.4.2002v7.4.2002
Problem: Crash when passing number to filter() or map().
Solution: Convert to a string. (Ozaki Kiichi)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index 445b6b91c..a51225d56 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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; |