summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-10 22:42:50 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-10 22:42:50 +0100
commit75ab91ff3403e725a79ac9c7351b78e9aff71d67 (patch)
tree624dae1f8aaeff2cfcd5aea7ac6aad5573835072 /src/list.c
parent6f02b00bb0958f70bc15534e115b4c6dadff0e06 (diff)
downloadvim-git-75ab91ff3403e725a79ac9c7351b78e9aff71d67.tar.gz
patch 8.2.2325: Vim9: crash if map() changes the item typev8.2.2325
Problem: Vim9: crash if map() changes the item type. Solution: Check that the item type is still OK. (closes #7652) Fix problem with mapnew() on range list.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/list.c b/src/list.c
index 4531e5885..2b44ebacb 100644
--- a/src/list.c
+++ b/src/list.c
@@ -2188,10 +2188,13 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap)
int stride = l->lv_u.nonmat.lv_stride;
// List from range(): loop over the numbers
- l->lv_first = NULL;
- l->lv_u.mat.lv_last = NULL;
- l->lv_len = 0;
- l->lv_u.mat.lv_idx_item = NULL;
+ if (filtermap != FILTERMAP_MAPNEW)
+ {
+ l->lv_first = NULL;
+ l->lv_u.mat.lv_last = NULL;
+ l->lv_len = 0;
+ l->lv_u.mat.lv_idx_item = NULL;
+ }
for (idx = 0; idx < len; ++idx)
{