Mercurial > vim
changeset 8753:df91c8263f04 v7.4.1665
commit https://github.com/vim/vim/commit/8038568722a0aad72d001edf4972c29abab57f8f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 27 19:13:35 2016 +0200
patch 7.4.1665
Problem: Crash when calling job_start() with a NULL string. (Dominique)
Solution: Check for an invalid argument.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 27 Mar 2016 19:15:04 +0200 |
parents | 03314a19539f |
children | 8d0e97cf1344 |
files | src/channel.c src/testdir/test_channel.vim src/version.c |
diffstat | 3 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -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;
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -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')