Compare commits

...

2 Commits

Author SHA1 Message Date
Bram Moolenaar
8038568722 patch 7.4.1665
Problem:    Crash when calling job_start() with a NULL string. (Dominique)
Solution:   Check for an invalid argument.
2016-03-27 19:13:35 +02:00
Bram Moolenaar
89c64d557d patch 7.4.1664
Problem:    Crash in :cgetexpr.
Solution:   Check for NULL pointer. (Dominique) Add a test.
2016-03-27 18:44:40 +02:00
5 changed files with 21 additions and 1 deletions

View File

@@ -3812,6 +3812,11 @@ job_start(typval_T *argvars)
{
/* Command is a string. */
cmd = argvars[0].vval.v_string;
if (cmd == NULL || *cmd == NUL)
{
EMSG(_(e_invarg));
return job;
}
#ifdef USE_ARGV
if (mch_parse_cmd(cmd, FALSE, &argv, &argc) == FAIL)
return job;

View File

@@ -532,7 +532,8 @@ qf_init_ext(
else if (tv->v_type == VAR_LIST)
{
/* Get the next line from the supplied list */
while (p_li && p_li->li_tv.v_type != VAR_STRING)
while (p_li && (p_li->li_tv.v_type != VAR_STRING
|| p_li->li_tv.vval.v_string == NULL))
p_li = p_li->li_next; /* Skip non-string items */
if (!p_li) /* End of the list */

View File

@@ -1201,5 +1201,10 @@ func Test_close_callback()
call s:run_server('s:test_close_callback')
endfunc
func Test_job_start_invalid()
call assert_fails('call job_start($x)', 'E474:')
call assert_fails('call job_start("")', 'E474:')
endfunc
" Uncomment this to see what happens, output is in src/testdir/channellog.
" call ch_logfile('channellog', 'w')

View File

@@ -692,3 +692,8 @@ func Test_caddbuffer_to_empty()
endtry
quit!
endfunc
func Test_cgetexpr_works()
" this must not crash Vim
cgetexpr [$x]
endfunc

View File

@@ -748,6 +748,10 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1665,
/**/
1664,
/**/
1663,
/**/