aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-03 06:46:30 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-09-03 09:01:09 +0800
commit7243b1cbde8a08deab6bf29b452b3383fa4f6d8d (patch)
treef6eaa87ecabe79c63dae4852b48476dc8b91d771 /src/nvim/ex_docmd.c
parent05b49ef975664ccdfea4e7b5a0fc09c8ed2cf11a (diff)
downloadrneovim-7243b1cbde8a08deab6bf29b452b3383fa4f6d8d.tar.gz
rneovim-7243b1cbde8a08deab6bf29b452b3383fa4f6d8d.tar.bz2
rneovim-7243b1cbde8a08deab6bf29b452b3383fa4f6d8d.zip
vim-patch:9.0.0360: crash when invalid line number on :for is ignored
Problem: Crash when invalid line number on :for is ignored. Solution: Do not check breakpoint for non-existing line. https://github.com/vim/vim/commit/35d21c6830fc2d68aca838424a0e786821c5891c Test does not fail without the fix in Nvim as Nvim uses 0 when line number overflows. If it is changed to MAXLNUM then the test does fail without the fix, but using 0 seems better as E481 is still given.
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index c2c5bb90ce..6517ebd081 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -642,7 +642,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
// 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), fname,
((wcmd_T *)lines_ga.ga_data)[current_line].lnum - 1);
*dbg_tick = debug_tick;