0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.2.3244: Lua 5.3 print() with a long string crashes

Problem:    Lua 5.3 print() with a long string crashes.
Solution:   Use a growarray instead of a Lua buffer. (Yegappan Lakshmanan,
            closes #8655)
This commit is contained in:
Yegappan Lakshmanan
2021-07-29 20:22:14 +02:00
committed by Bram Moolenaar
parent 83cd0156e0
commit 41114a2a27
4 changed files with 34 additions and 8 deletions

View File

@@ -1565,6 +1565,22 @@ ga_concat(garray_T *gap, char_u *s)
}
}
/*
* Concatenate 'len' bytes from string 's' to a growarray.
* When "s" is NULL does not do anything.
*/
void
ga_concat_len(garray_T *gap, char_u *s, size_t len)
{
if (s == NULL || *s == NUL)
return;
if (ga_grow(gap, len) == OK)
{
mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);
gap->ga_len += len;
}
}
/*
* Append one byte to a growarray which contains bytes.
*/