To: vim_dev@googlegroups.com Subject: Patch 8.2.5126 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@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 ///