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

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