aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-12 18:23:38 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-02-12 18:52:34 +0000
commit1b0d6bcd53291d9a9d3e1252976bd22564db4fe5 (patch)
treed787294a4c7551b10c73c85784d27ae9c50481da /src/nvim/ex_cmds.c
parent05c3d02380770445983914dae1bf48e6ef37a6f6 (diff)
downloadrneovim-1b0d6bcd53291d9a9d3e1252976bd22564db4fe5.tar.gz
rneovim-1b0d6bcd53291d9a9d3e1252976bd22564db4fe5.tar.bz2
rneovim-1b0d6bcd53291d9a9d3e1252976bd22564db4fe5.zip
vim-patch:8.2.4359: crash when repeatedly using :retab
Problem: crash when repeatedly using :retab. Solution: Bail out when the line is getting too long. https://github.com/vim/vim/commit/6e28703a8e41f775f64e442c5d11ce1ff599aa3f Cherry-pick e_resulting_text_too_long from v8.2.3492; put it in globals.h as it will eventually be used in other files. Add a modeline to test_retab.vim
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index fd1e34803f..f6ef259dbd 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -847,6 +847,10 @@ void ex_retab(exarg_T *eap)
break;
}
vcol += win_chartabsize(curwin, ptr + col, (colnr_T)vcol);
+ if (vcol >= MAXCOL) {
+ emsg(_(e_resulting_text_too_long));
+ break;
+ }
col += utfc_ptr2len(ptr + col);
}
if (new_line == NULL) { // out of memory