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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220707190015.723BF1C04CD%40moolenaar.net.

Raspunde prin e-mail lui