Blame SOURCES/0001-patch-8.2.3625-illegal-memory-access-when-C-indentin.patch

b6500d
diff --git a/src/misc1.c b/src/misc1.c
b6500d
index de79c8e..1c5867d 100644
b6500d
--- a/src/misc1.c
b6500d
+++ b/src/misc1.c
b6500d
@@ -6792,7 +6792,7 @@ find_start_brace(void)	    /* XXX */
b6500d
 		       && (pos = ind_find_start_CORS(NULL)) == NULL) /* XXX */
b6500d
 	    break;
b6500d
 	if (pos != NULL)
b6500d
-	    curwin->w_cursor.lnum = pos->lnum;
b6500d
+	    curwin->w_cursor = *pos;
b6500d
     }
b6500d
     curwin->w_cursor = cursor_save;
b6500d
     return trypos;
b6500d
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
b6500d
index 7c2c5e3..f8c7e57 100644
b6500d
--- a/src/testdir/test_cindent.vim
b6500d
+++ b/src/testdir/test_cindent.vim
b6500d
@@ -102,4 +102,16 @@ func Test_cindent_expr()
b6500d
   bw!
b6500d
 endfunc
b6500d
 
b6500d
+func Test_find_brace_backwards()
b6500d
+  " this was looking beyond the end of the line
b6500d
+  new
b6500d
+  norm R/*
b6500d
+  norm o0{
b6500d
+  norm o//
b6500d
+  norm V{=
b6500d
+  call assert_equal(['/*', '   0{', '//'], getline(1, 3))
b6500d
+  bwipe!
b6500d
+endfunc
b6500d
+
b6500d
+
b6500d
 " vim: shiftwidth=2 sts=2 expandtab