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.
6e28703a8e

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
This commit is contained in:
Sean Dewar
2022-02-12 18:23:38 +00:00
parent 05c3d02380
commit 1b0d6bcd53
3 changed files with 27 additions and 0 deletions

View File

@@ -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