Patch 9.0.0046

4 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 7, 2022, 3:00:28 PM7/7/22
to vim...@googlegroups.com

Patch 9.0.0046
Problem: Reading past end of completion with duplicate match.
Solution: Check string length
Files: src/insexpand.c, src/testdir/test_ins_complete.vim


*** ../vim-9.0.0045/src/insexpand.c 2022-07-07 19:42:01.089608668 +0100
--- src/insexpand.c 2022-07-07 19:56:55.974260236 +0100
***************
*** 786,792 ****
{
if (!match_at_original_text(match)
&& STRNCMP(match->cp_str, str, len) == 0
! && match->cp_str[len] == NUL)
return NOTDONE;
match = match->cp_next;
} while (match != NULL && !is_first_match(match));
--- 786,793 ----
{
if (!match_at_original_text(match)
&& STRNCMP(match->cp_str, str, len) == 0
! && ((int)STRLEN(match->cp_str) <= len
! || match->cp_str[len] == NUL))
return NOTDONE;
match = match->cp_next;
} while (match != NULL && !is_first_match(match));
*** ../vim-9.0.0045/src/testdir/test_ins_complete.vim 2022-07-07 19:42:01.089608668 +0100
--- src/testdir/test_ins_complete.vim 2022-07-07 19:53:02.594239140 +0100
***************
*** 2112,2116 ****
--- 2112,2126 ----
set noic noinfercase
endfunc

+ func Test_ins_complete_add()
+ " this was reading past the end of allocated memory
+ new
+ norm o
+ norm 7o€€
+ sil! norm o
+
+ bwipe!
+ endfunc
+

" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0045/src/version.c 2022-07-07 19:42:01.089608668 +0100
--- src/version.c 2022-07-07 19:59:17.662248310 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 46,
/**/

--
hundred-and-one symptoms of being an internet addict:
78. You find yourself dialing IP numbers on the phone.

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