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)
diff --git a/src/misc2.c b/src/misc2.c
index bc984b2..bbf55bb 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1566,6 +1566,22 @@
}
/*
+ * 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.
*/
void