Blame SOURCES/0001-patch-8.2.4151-reading-beyond-the-end-of-a-line.patch

9bb4fd
diff --git a/src/ops.c b/src/ops.c
9bb4fd
index e9cfb1d..e35b033 100644
9bb4fd
--- a/src/ops.c
9bb4fd
+++ b/src/ops.c
9bb4fd
@@ -629,26 +629,9 @@ block_insert(
9bb4fd
 
9bb4fd
 #ifdef FEAT_MBYTE
9bb4fd
 	if (has_mbyte && spaces > 0)
9bb4fd
-	{
9bb4fd
-	    int off;
9bb4fd
+	    // avoid copying part of a multi-byte character
9bb4fd
+	    offset -= (*mb_head_off)(oldp, oldp + offset);
9bb4fd
 
9bb4fd
-	    /* Avoid starting halfway a multi-byte character. */
9bb4fd
-	    if (b_insert)
9bb4fd
-	    {
9bb4fd
-		off = (*mb_head_off)(oldp, oldp + offset + spaces);
9bb4fd
-		spaces -= off;
9bb4fd
-		count -= off;
9bb4fd
-	    }
9bb4fd
-	    else
9bb4fd
-	    {
9bb4fd
-		// spaces fill the gap, the character that's at the edge moves
9bb4fd
-		// right
9bb4fd
-		off = (*mb_head_off)(oldp, oldp + offset);
9bb4fd
-		offset -= off;
9bb4fd
-	    }
9bb4fd
-	    spaces -= off;
9bb4fd
-	    count -= off;
9bb4fd
-	}
9bb4fd
 #endif
9bb4fd
 
9bb4fd
 	// Make sure the allocated size matches what is actually copied below.
9bb4fd
diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim
9bb4fd
index 24e3db8..1042720 100644
9bb4fd
--- a/src/testdir/test_utf8.vim
9bb4fd
+++ b/src/testdir/test_utf8.vim
9bb4fd
@@ -9,7 +9,7 @@ func Test_visual_block_insert()
9bb4fd
   new
9bb4fd
   call setline(1, ["aaa", "あああ", "bbb"])
9bb4fd
   exe ":norm! gg0l\<C-V>jjIx\<Esc>"
9bb4fd
-  call assert_equal(['axaa', 'xあああ', 'bxbb'], getline(1, '$'))
9bb4fd
+  call assert_equal(['axaa', ' xあああ', 'bxbb'], getline(1, '$'))
9bb4fd
   bwipeout!
9bb4fd
 endfunc
9bb4fd