Patch 8.2.3625

10 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 19, 2021, 2:41:58 PM11/19/21
to vim...@googlegroups.com

Patch 8.2.3625
Problem: Illegal memory access when C-indenting.
Solution: Also set the cursor column.
Files: src/cindent.c, src/testdir/test_cindent.vim


*** ../vim-8.2.3624/src/cindent.c 2021-10-05 21:58:49.164899480 +0100
--- src/cindent.c 2021-11-19 19:39:52.299790745 +0000
***************
*** 1637,1646 ****
static pos_T *
find_start_brace(void) // XXX
{
! pos_T cursor_save;
! pos_T *trypos;
! pos_T *pos;
! static pos_T pos_copy;

cursor_save = curwin->w_cursor;
while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)
--- 1637,1646 ----
static pos_T *
find_start_brace(void) // XXX
{
! pos_T cursor_save;
! pos_T *trypos;
! pos_T *pos;
! static pos_T pos_copy;

cursor_save = curwin->w_cursor;
while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)
***************
*** 1654,1660 ****
&& (pos = ind_find_start_CORS(NULL)) == NULL) // XXX
break;
if (pos != NULL)
! curwin->w_cursor.lnum = pos->lnum;
}
curwin->w_cursor = cursor_save;
return trypos;
--- 1654,1660 ----
&& (pos = ind_find_start_CORS(NULL)) == NULL) // XXX
break;
if (pos != NULL)
! curwin->w_cursor = *pos;
}
curwin->w_cursor = cursor_save;
return trypos;
*** ../vim-8.2.3624/src/testdir/test_cindent.vim 2021-10-05 21:58:49.164899480 +0100
--- src/testdir/test_cindent.vim 2021-11-19 19:38:30.655517674 +0000
***************
*** 5314,5317 ****
--- 5314,5329 ----
bwipe!
endfunc

+ func Test_find_brace_backwards()
+ " this was looking beyond the end of the line
+ new
+ norm R/*
+ norm o0{
+ norm o//
+ norm V{=
+ call assert_equal(['/*', ' 0{', '//'], getline(1, 3))
+ bwipe!
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3624/src/version.c 2021-11-19 17:01:05.559037762 +0000
--- src/version.c 2021-11-19 19:30:47.156462528 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3625,
/**/

--
TALL KNIGHT: Firstly. You must get us another shrubbery!
OTHER KNIGHTS: More shrubberies! More shrubberies for the ex-Knights of Ni!
ARTHUR: Not another shrubbery -
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages