To: vim_dev@googlegroups.com Subject: Patch 8.2.5148 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5148 Problem: Invalid memory access when using an expression on the command line. Solution: Make sure the position does not go negative. Files: src/ex_getln.c, src/testdir/test_cmdline.vim *** ../vim-8.2.5147/src/ex_getln.c 2022-06-16 11:14:51.953291054 +0100 --- src/ex_getln.c 2022-06-22 13:45:19.915255481 +0100 *************** *** 1206,1211 **** --- 1206,1212 ---- { int i; int c; + int save_new_cmdpos = new_cmdpos; #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; // disallow scrolling here *************** *** 1224,1231 **** #ifdef FEAT_EVAL /* * Insert the result of an expression. - * Need to save the current command line, to be able to enter - * a new one... */ new_cmdpos = -1; if (c == '=') --- 1225,1230 ---- *************** *** 1266,1271 **** --- 1265,1272 ---- } #endif } + new_cmdpos = save_new_cmdpos; + // remove the double quote redrawcmd(); *** ../vim-8.2.5147/src/testdir/test_cmdline.vim 2022-06-06 15:38:10.867573392 +0100 --- src/testdir/test_cmdline.vim 2022-06-22 13:41:21.352562312 +0100 *************** *** 1987,1992 **** --- 1987,1997 ---- call assert_equal("\"e \\", @:) endfunc + " This was making the insert position negative + func Test_cmdline_expr_register() + exe "sil! norm! ?\e0\0\?\e0\" + endfunc + " Test for 'imcmdline' and 'imsearch' " This test doesn't actually test the input method functionality. func Test_cmdline_inputmethod() *** ../vim-8.2.5147/src/version.c 2022-06-21 22:35:37.067256396 +0100 --- src/version.c 2022-06-22 13:43:27.343930727 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5148, /**/ -- For large projects, Team Leaders use sophisticated project management software to keep track of who's doing what. The software collects the lies and guesses of the project team and organizes them in to instantly outdated charts that are too boring to look at closely. This is called "planning". (Scott Adams - The Dilbert principle) /// 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 ///