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))
 	    {
diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim
index bfb90c1..a5fd4fb 100644
--- a/src/testdir/test_utf8.vim
+++ b/src/testdir/test_utf8.vim
@@ -180,4 +180,13 @@
   call assert_fails('call setcellwidths([[0x33, 0x44, 2]])', 'E1114:')
 endfunc
 
+func Test_print_overlong()
+  " Text with more composing characters than MB_MAXBYTES.
+  new
+  call setline(1, 'axxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
+  s/x/\=nr2char(1629)/g
+  print
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 9234d39..2eb5de5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2078,
+/**/
     2077,
 /**/
     2076,