mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06: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 is actual number of white characters used
|
||||||
len = num_spaces + num_tabs;
|
len = num_spaces + num_tabs;
|
||||||
old_len = (long)STRLEN(ptr);
|
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);
|
new_line = xmalloc(new_len);
|
||||||
|
|
||||||
if (start_col > 0) {
|
if (start_col > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user