Patch 8.2.2887
Problem: Crash when passing null string to fullcommand().
Solution: Check for NULL pointer. (closes #8256)
Files: src/ex_docmd.c, src/testdir/test_cmdline.vim
*** ../vim-8.2.2886/src/ex_docmd.c 2021-05-18 21:46:27.712961269 +0200
--- src/ex_docmd.c 2021-05-26 19:48:53.792273759 +0200
***************
*** 3791,3802 ****
char_u *name = argvars[0].vval.v_string;
char_u *p;
! while (name[0] != NUL && name[0] == ':')
name++;
name = skip_range(name, TRUE, NULL);
- rettv->v_type = VAR_STRING;
-
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
ea.cmdidx = (cmdidx_T)0;
p = find_ex_command(&ea, NULL, NULL, NULL);
--- 3791,3805 ----
char_u *name = argvars[0].vval.v_string;
char_u *p;
! rettv->v_type = VAR_STRING;
! rettv->vval.v_string = NULL;
! if (name == NULL)
! return;
!
! while (*name != NUL && *name == ':')
name++;
name = skip_range(name, TRUE, NULL);
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
ea.cmdidx = (cmdidx_T)0;
p = find_ex_command(&ea, NULL, NULL, NULL);
*** ../vim-8.2.2886/src/testdir/test_cmdline.vim 2021-05-19
17:15:00.825866111 +0200
--- src/testdir/test_cmdline.vim 2021-05-26 19:37:59.797915051 +0200
***************
*** 475,480 ****
--- 475,481 ----
for [in, want] in items(tests)
call assert_equal(want, fullcommand(in))
endfor
+ call assert_equal('', fullcommand(test_null_string()))
call assert_equal('syntax', 'syn'->fullcommand())
endfunc
*** ../vim-8.2.2886/src/version.c 2021-05-25 20:13:56.316778428 +0200
--- src/version.c 2021-05-26 19:39:00.537767384 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2887,
/**/
--
ARTHUR: A scratch? Your arm's off!
BLACK KNIGHT: No, it isn't.
ARTHUR: Well, what's that then?
BLACK KNIGHT: I've had worse.
The Quest for the Holy Grail (Monty Python)
/// 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/202105261749.14QHnbXc773448%40masaka.moolenaar.net.