Patch 8.2.5126
Problem:    Substitute may overrun destination buffer.
Solution:   Disallow switching buffers in a substitute expression.
Files:      src/ex_docmd.c, src/testdir/test_substitute.vim


*** ../vim-8.2.5125/src/ex_docmd.c      2022-06-14 16:06:03.861470994 +0100
--- src/ex_docmd.c      2022-06-18 19:47:49.105533464 +0100
***************
*** 7138,7146 ****
  #endif
            )
      {
!       // Can't edit another file when "curbuf_lock" is set.  Only ":edit"
!       // can bring us here, others are stopped earlier.
!       if (*eap->arg != NUL && curbuf_locked())
            return;
  
        n = readonlymode;
--- 7138,7147 ----
  #endif
            )
      {
!       // Can't edit another file when "textlock" or "curbuf_lock" is set.
!       // Only ":edit" or ":script" can bring us here, others are stopped
!       // earlier.
!       if (*eap->arg != NUL && text_or_buf_locked())
            return;
  
        n = readonlymode;
*** ../vim-8.2.5125/src/testdir/test_substitute.vim     2022-06-12 
11:12:58.948404646 +0100
--- src/testdir/test_substitute.vim     2022-06-18 19:43:19.521854278 +0100
***************
*** 1063,1068 ****
--- 1063,1081 ----
    call delete('Xresult')
  endfunc
  
+ " This was editing a script file from the expression
+ func Test_sub_edit_scriptfile()
+   new
+   norm o0000000000000000000000000000000000000000000000000000
+   func EditScript()
+     silent! scr! Xfile
+   endfunc
+   s/\%')/\=EditScript()
+ 
+   delfunc EditScript
+   bwipe!
+ endfunc
+ 
  " Test for the 2-letter and 3-letter :substitute commands
  func Test_substitute_short_cmd()
    new
*** ../vim-8.2.5125/src/version.c       2022-06-18 16:48:32.762559984 +0100
--- src/version.c       2022-06-18 19:07:15.810121157 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5126,
  /**/

-- 
"Lisp has all the visual appeal of oatmeal with nail clippings thrown in."
                                                         -- Larry Wall

 /// 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/20220618184934.523C01C12E9%40moolenaar.net.

Raspunde prin e-mail lui