Patch 8.2.4218
Problem:    Illegal memory access with bracketed paste in Ex mode.
Solution:   Reserve space for the trailing NUL.
Files:      src/edit.c, src/testdir/test_paste.vim


*** ../vim-8.2.4217/src/edit.c  2022-01-24 15:27:47.179058453 +0000
--- src/edit.c  2022-01-25 20:42:39.737152799 +0000
***************
*** 4452,4458 ****
                    break;
  
                case PASTE_EX:
!                   if (gap != NULL && ga_grow(gap, idx) == OK)
                    {
                        mch_memmove((char *)gap->ga_data + gap->ga_len,
                                                             buf, (size_t)idx);
--- 4452,4459 ----
                    break;
  
                case PASTE_EX:
!                   // add one for the NUL that is going to be appended
!                   if (gap != NULL && ga_grow(gap, idx + 1) == OK)
                    {
                        mch_memmove((char *)gap->ga_data + gap->ga_len,
                                                             buf, (size_t)idx);
*** ../vim-8.2.4217/src/testdir/test_paste.vim  2021-10-16 13:00:10.936165341 
+0100
--- src/testdir/test_paste.vim  2022-01-25 20:41:48.286093667 +0000
***************
*** 90,95 ****
--- 90,98 ----
    unlet! foo
    call feedkeys("Qlet foo=\"\<Esc>[200~foo\<CR>bar\<Esc>[201~\"\<CR>vi\<CR>", 
'xt')
    call assert_equal("foo\rbar", foo)
+ 
+   " pasting more than 40 bytes
+   exe "norm 
Q\<PasteStart>0000000000000000000000000000000000000000000000000000000000000000000000\<C-C>"
  endfunc
  
  func Test_paste_onechar()
*** ../vim-8.2.4217/src/version.c       2022-01-25 18:23:57.102514548 +0000
--- src/version.c       2022-01-25 20:27:48.340762717 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4218,
  /**/

-- 
Beer & pretzels can't be served at the same time in any bar or restaurant.
                [real standing law in North Dakota, United States of America]

 /// 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/20220125204550.6784A1C042A%40moolenaar.net.

Raspunde prin e-mail lui