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

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