To: vim_dev@googlegroups.com Subject: Patch 8.2.4261 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4261 Problem: Accessing invalid memory when a regular expression checks the Visual area while matching in a string. Solution: Do not try matching the Visual area in a string. Files: src/regexp.c, src/testdir/test_help.vim *** ../vim-8.2.4260/src/regexp.c 2022-01-05 20:24:34.276005641 +0000 --- src/regexp.c 2022-01-30 16:41:32.350739976 +0000 *************** *** 1267,1274 **** colnr_T cols; colnr_T curswant; ! // Check if the buffer is the current buffer. ! if (rex.reg_buf != curbuf || VIsual.lnum == 0) return FALSE; if (VIsual_active) --- 1267,1274 ---- colnr_T cols; colnr_T curswant; ! // Check if the buffer is the current buffer and not using a string. ! if (rex.reg_buf != curbuf || VIsual.lnum == 0 || rex.reg_maxline == 0) return FALSE; if (VIsual_active) *** ../vim-8.2.4260/src/testdir/test_help.vim 2022-01-03 12:53:20.662699885 +0000 --- src/testdir/test_help.vim 2022-01-30 16:40:38.583614348 +0000 *************** *** 1,6 **** --- 1,7 ---- " Tests for :help source check.vim + import './vim9.vim' as v9 func Test_help_restore_snapshot() help *************** *** 168,172 **** --- 169,183 ---- endtry endfunc + func Test_help_using_visual_match() + let lines =<< trim END + call setline(1, ' ') + /^ + exe "normal \\" + h5\%V€] + END + call v9.CheckScriptFailure(lines, 'E149:') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4260/src/version.c 2022-01-30 15:28:26.646294975 +0000 --- src/version.c 2022-01-30 16:11:17.545709897 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4261, /**/ -- DENNIS: Oh, very nice. King, eh! I expect you've got a palace and fine clothes and courtiers and plenty of food. And how d'you get that? By exploiting the workers! By hanging on to outdated imperialist dogma which perpetuates the social and economic differences in our society! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///