Mercurial > vim
comparison src/list.c @ 23565:34aa2907082a v8.2.2325
patch 8.2.2325: Vim9: crash if map() changes the item type
Commit: https://github.com/vim/vim/commit/75ab91ff3403e725a79ac9c7351b78e9aff71d67
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 10 22:42:50 2021 +0100
patch 8.2.2325: Vim9: crash if map() changes the item type
Problem: Vim9: crash if map() changes the item type.
Solution: Check that the item type is still OK. (closes https://github.com/vim/vim/issues/7652)
Fix problem with mapnew() on range list.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 10 Jan 2021 22:45:06 +0100 |
parents | 1bb7fa4f9b35 |
children | 510088f8c66f |
comparison
equal
deleted
inserted
replaced
23564:469359887d3e | 23565:34aa2907082a |
---|---|
2186 varnumber_T val = l->lv_u.nonmat.lv_start; | 2186 varnumber_T val = l->lv_u.nonmat.lv_start; |
2187 int len = l->lv_len; | 2187 int len = l->lv_len; |
2188 int stride = l->lv_u.nonmat.lv_stride; | 2188 int stride = l->lv_u.nonmat.lv_stride; |
2189 | 2189 |
2190 // List from range(): loop over the numbers | 2190 // List from range(): loop over the numbers |
2191 l->lv_first = NULL; | 2191 if (filtermap != FILTERMAP_MAPNEW) |
2192 l->lv_u.mat.lv_last = NULL; | 2192 { |
2193 l->lv_len = 0; | 2193 l->lv_first = NULL; |
2194 l->lv_u.mat.lv_idx_item = NULL; | 2194 l->lv_u.mat.lv_last = NULL; |
2195 l->lv_len = 0; | |
2196 l->lv_u.mat.lv_idx_item = NULL; | |
2197 } | |
2195 | 2198 |
2196 for (idx = 0; idx < len; ++idx) | 2199 for (idx = 0; idx < len; ++idx) |
2197 { | 2200 { |
2198 typval_T tv; | 2201 typval_T tv; |
2199 typval_T newtv; | 2202 typval_T newtv; |