Patch 9.0.0060

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 23, 2022, 4:11:06 AM7/23/22
to vim...@googlegroups.com

Patch 9.0.0060
Problem: Accessing uninitialized memory when completing long line.
Solution: Terminate string with NUL.
Files: src/insexpand.c, src/testdir/test_ins_complete.vim


*** ../vim-9.0.0059/src/insexpand.c 2022-07-15 20:45:11.130168352 +0100
--- src/insexpand.c 2022-07-23 06:51:07.949613376 +0100
***************
*** 642,647 ****
--- 642,648 ----
// growarray. Add the character in the next round.
if (ga_grow(&gap, IOSIZE) == FAIL)
return (char_u *)"[failed]";
+ *p = NUL;
STRCPY(gap.ga_data, IObuff);
gap.ga_len = (int)STRLEN(IObuff);
}
*** ../vim-9.0.0059/src/testdir/test_ins_complete.vim 2022-07-07 19:59:45.466244217 +0100
--- src/testdir/test_ins_complete.vim 2022-07-23 06:46:41.445517250 +0100
***************
*** 2108,2113 ****
--- 2108,2120 ----
exe "normal 2Go\<C-X>\<C-L>\<Esc>"
call assert_equal(longLine, getline(3))

+ " check that the too long text is NUL terminated
+ %del
+ norm o
+ norm 1987ax
+ exec "norm ox\<C-X>\<C-L>"
+ call assert_equal(repeat('x', 1987), getline(3))
+
bwipe!
set noic noinfercase
endfunc
*** ../vim-9.0.0059/src/version.c 2022-07-23 06:24:56.409106034 +0100
--- src/version.c 2022-07-23 06:52:32.717639744 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 60,
/**/

--
hundred-and-one symptoms of being an internet addict:
101. U can read htis w/o ny porblm and cant figur eout Y its evn listd.

/// 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