mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00: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:
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user