aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-10-08 21:05:38 +0100
committerzeertzjq <zeertzjq@outlook.com>2022-04-13 21:28:05 +0800
commitfc954d0a61ca8952bdcd05f66fe07ae2a4ccb712 (patch)
tree6be84cfc98563dfb506c9e05a6194358ea575e61 /src/nvim/testdir
parent789558d365a3134a33cdf4f1f3cc5e77efcad687 (diff)
downloadrneovim-fc954d0a61ca8952bdcd05f66fe07ae2a4ccb712.tar.gz
rneovim-fc954d0a61ca8952bdcd05f66fe07ae2a4ccb712.tar.bz2
rneovim-fc954d0a61ca8952bdcd05f66fe07ae2a4ccb712.zip
vim-patch:8.2.3486: illegal memory access with invalid sequence of commands
Problem: Illegal memory access with invalid sequence of commands. Solution: Do not call leave_block() when not in a try block. (closes vim/vim#8966) Reset did_emsg so that exception is shown as an error. https://github.com/vim/vim/commit/cce81e9673fe8d056e8eef310d9919620eccb2f2 Vim9script is N/A, which includes leave_block.
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_trycatch.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_trycatch.vim b/src/nvim/testdir/test_trycatch.vim
index 34c402fc73..205ed095ea 100644
--- a/src/nvim/testdir/test_trycatch.vim
+++ b/src/nvim/testdir/test_trycatch.vim
@@ -2067,5 +2067,26 @@ func Test_error_in_catch_and_finally()
call delete('XtestCatchAndFinally')
endfunc
+" This was causing an illegal memory access
+func Test_leave_block_in_endtry_not_called()
+ let lines =<< trim END
+ " vim9script
+ " try #
+ try "
+ for x in []
+ if
+ endwhile
+ if
+ endtry
+ END
+ call writefile(lines, 'XtestEndtry')
+ try
+ source XtestEndtry
+ catch /E171:/
+ endtry
+
+ call delete('XtestEndtry')
+endfunc
+
" Modeline {{{1
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker