diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-02 16:47:16 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-02 16:47:16 +0100 |
commit | 35d21c6830fc2d68aca838424a0e786821c5891c (patch) | |
tree | 129500dfedad747749dbb49a78b54bc630c6df8d | |
parent | 8deb2b30c77035bb682ccf80b781455ac1d6038b (diff) |
patch 9.0.0360: crash when invalid line number on :for is ignoredv9.0.0360
Problem: Crash when invalid line number on :for is ignored.
Solution: Do not check breakpoint for non-existing line.
-rw-r--r-- | src/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/testdir/test_eval_stuff.vim | 13 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index ae1f1959b7..0b6b217121 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1068,7 +1068,7 @@ do_cmdline( // Check for the next breakpoint at or after the ":while" // or ":for". - if (breakpoint != NULL) + if (breakpoint != NULL && lines_ga.ga_len > current_line) { *breakpoint = dbg_find_breakpoint( getline_equal(fgetline, cookie, getsourceline), diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index 313d791850..934286bbe8 100644 --- a/src/testdir/test_eval_stuff.vim +++ b/src/testdir/test_eval_stuff.vim @@ -1,6 +1,7 @@ " Tests for various eval things. source view_util.vim +source shared.vim function s:foo() abort try @@ -87,6 +88,18 @@ func Test_for_over_null_string() let &enc = save_enc endfunc +func Test_for_invalid_line_count() + let lines =<< trim END + 111111111111111111111111 for line in ['one'] + endfor + END + call writefile(lines, 'XinvalidFor') + " only test that this doesn't crash + call RunVim([], [], '-u NONE -e -s -S XinvalidFor -c qa') + + call delete('XinvalidFor') +endfunc + func Test_readfile_binary() new call setline(1, ['one', 'two', 'three']) diff --git a/src/version.c b/src/version.c index fa2d9d54e2..4f2b3dcf15 100644 --- a/src/version.c +++ b/src/version.c @@ -708,6 +708,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 360, +/**/ 359, /**/ 358, |