Blame SOURCES/0001-patch-8.2.3950-going-beyond-the-end-of-the-line-with.patch

b6500d
diff -up vim80/src/charset.c.cve4193 vim80/src/charset.c
b6500d
--- vim80/src/charset.c.cve4193	2022-01-12 14:49:08.710592947 +0100
b6500d
+++ vim80/src/charset.c	2022-01-12 14:49:47.594705863 +0100
b6500d
@@ -1291,10 +1291,15 @@ getvcol(
b6500d
 	posptr = NULL;  /* continue until the NUL */
b6500d
     else
b6500d
     {
b6500d
-	/* Special check for an empty line, which can happen on exit, when
b6500d
-	 * ml_get_buf() always returns an empty string. */
b6500d
-	if (*ptr == NUL)
b6500d
-	    pos->col = 0;
b6500d
+	colnr_T i;
b6500d
+
b6500d
+	// In a few cases the position can be beyond the end of the line.
b6500d
+	for (i = 0; i < pos->col; ++i)
b6500d
+	    if (ptr[i] == NUL)
b6500d
+	    {
b6500d
+		pos->col = i;
b6500d
+		break;
b6500d
+	    }
b6500d
 	posptr = ptr + pos->col;
b6500d
 #ifdef FEAT_MBYTE
b6500d
 	if (has_mbyte)
b6500d
diff -up vim80/src/testdir/test_regexp_latin.vim.cve4193 vim80/src/testdir/test_regexp_latin.vim
b6500d
--- vim80/src/testdir/test_regexp_latin.vim.cve4193	2022-01-12 14:49:08.710592947 +0100
b6500d
+++ vim80/src/testdir/test_regexp_latin.vim	2022-01-12 14:50:45.186873107 +0100
b6500d
@@ -72,3 +72,11 @@ func Test_backref()
b6500d
   call assert_fails('call search("\\%#=2\\(e\\1\\)")', 'E65:')
b6500d
   bwipe!
b6500d
 endfunc
b6500d
+
b6500d
+func Test_using_invalid_visual_position()
b6500d
+  " this was going beyond the end of the line
b6500d
+  new
b6500d
+  exe "norm 0o000\<Esc>0\<C-V>$s0"
b6500d
+  /\%V
b6500d
+  bwipe!
b6500d
+endfunc