From 44a5875b24f033c472af50aa4eec4468c554b7c9 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 6 Dec 2021 22:43:59 +0000 Subject: vim-patch:8.2.1051: crash when changing a list while using reduce() on it Problem: Crash when changing a list while using reduce() on it. Solution: Lock the list. (closes vim/vim#6330) https://github.com/vim/vim/commit/ca275a05d8b79f6a9101604fdede2373d0dea44e --- src/nvim/testdir/test_listdict.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim index 42b46fc76c..fdf9123d82 100644 --- a/src/nvim/testdir/test_listdict.vim +++ b/src/nvim/testdir/test_listdict.vim @@ -649,6 +649,15 @@ func Test_reduce() call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E897:') call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E897:') call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E897:') + + let g:lut = [1, 2, 3, 4] + func EvilRemove() + call remove(g:lut, 1) + return 1 + endfunc + call assert_fails("call reduce(g:lut, { acc, val -> EvilRemove() }, 1)", 'E742:') + unlet g:lut + delfunc EvilRemove endfunc " splitting a string to a List -- cgit