mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
vim-patch:8.2.4362: :retab may allocate too much memory
Problem: :retab may allocate too much memory.
Solution: Bail out when allocating more than MAXCOL bytes.
33f3c59854
This commit is contained in:
parent
1b0d6bcd53
commit
700af0ab1d
@ -814,7 +814,11 @@ void ex_retab(exarg_T *eap)
|
||||
// len is actual number of white characters used
|
||||
len = num_spaces + num_tabs;
|
||||
old_len = (long)STRLEN(ptr);
|
||||
long new_len = old_len - col + start_col + len + 1;
|
||||
const long new_len = old_len - col + start_col + len + 1;
|
||||
if (new_len >= MAXCOL) {
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
break;
|
||||
}
|
||||
new_line = xmalloc(new_len);
|
||||
|
||||
if (start_col > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user