patch 8.2.2078: illegal memory access when using :print on invalid text
Problem: Illegal memory access when using :print on invalid text. (Dhiraj
Mishra)
Solution: Check for more composing characters than supported. (closes #7399)
diff --git a/src/message.c b/src/message.c
index f8efabc..3f6d56e 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1859,7 +1859,11 @@
else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
{
col += (*mb_ptr2cells)(s);
- if (lcs_nbsp != NUL && list
+ if (l >= MB_MAXBYTES)
+ {
+ STRCPY(buf, "¿");
+ }
+ else if (lcs_nbsp != NUL && list
&& (mb_ptr2char(s) == 160
|| mb_ptr2char(s) == 0x202f))
{