Patch 8.2.5148

10 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 22, 2022, 8:52:24 AM6/22/22
to vim...@googlegroups.com

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 \<C-\>\<C-Y>", @:)
endfunc

+ " This was making the insert position negative
+ func Test_cmdline_expr_register()
+ exe "sil! norm! ?\<C-\>e0\<C-R>0\<Esc>?\<C-\>e0\<CR>"
+ 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 -- Br...@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 ///

Tony Mechelynck

unread,
Jun 22, 2022, 12:03:13 PM6/22/22
to Bram Moolenaar, vim_dev
On Wed, Jun 22, 2022 at 2:52 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> 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

With this patch, Tiny and Small do not build (with gcc 12.1.0 on
openSUSE Tumbleweed):

linux-tuxedo:~/.build/vim/vim-hg/src/shadow-tiny # (make || echo 'exit
status' $? ; date) 2>&1 |tee -a make.log
gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1 -o objects/ex_getln.o ex_getln.c
ex_getln.c: In function ‘cmdline_insert_reg’:
ex_getln.c:1209:35: error: ‘new_cmdpos’ undeclared (first use in this
function); did you mean ‘set_cmdspos’?
1209 | int save_new_cmdpos = new_cmdpos;
| ^~~~~~~~~~
| set_cmdspos
ex_getln.c:1209:35: note: each undeclared identifier is reported only
once for each function it appears in
make: *** [Makefile:3228: objects/ex_getln.o] Error 1
exit status 2
Wed 22 Jun 17:42:51 CEST 2022
linux-tuxedo:~/.build/vim/vim-hg/src/shadow-tiny #


Best regards,
Tony.

Bram Moolenaar

unread,
Jun 22, 2022, 1:15:05 PM6/22/22
to vim...@googlegroups.com, Tony Mechelynck
Ah yes, this needs a couple of #ifdefs.

--
A salesperson says: Translation:
"backward compatible" Old technology
"Premium" Overpriced
"Can't keep it on the shelf" Unavailable
"Stands alone" Piece of shit
"Proprietary" Incompatible
Reply all
Reply to author
Forward
0 new messages