patch 8.2.0029: MS-Windows: crash with empty job command
Problem: MS-Windows: crash with empty job command.
Solution: Check for NULL result. (Yasuhiro Matsumoto, closes #5390)
diff --git a/src/channel.c b/src/channel.c
index 7edca1a..aed234c 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -5947,6 +5947,11 @@
if (win32_build_cmd(l, &ga) == FAIL)
goto theend;
cmd = ga.ga_data;
+ if (cmd == NULL)
+ {
+ emsg(_(e_invarg));
+ goto theend;
+ }
#endif
}
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 17cdb7c..24a7ae4 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -1331,14 +1331,12 @@
endfunc
func Test_close_handle()
- call ch_log('Test_close_handle()')
call s:run_server('Ch_close_handle')
endfunc
""""""""""
func Test_open_fail()
- call ch_log('Test_open_fail()')
silent! let ch = ch_open("noserver")
echo ch
let d = ch
@@ -1360,7 +1358,6 @@
endfunc
func Test_open_delay()
- call ch_log('Test_open_delay()')
" The server will wait half a second before creating the port.
call s:run_server('Ch_open_delay', 'delay')
endfunc
@@ -1384,7 +1381,6 @@
endfunc
func Test_call()
- call ch_log('Test_call()')
call s:run_server('Ch_test_call')
endfunc
@@ -1473,7 +1469,6 @@
endfunc
func Test_close_callback()
- call ch_log('Test_close_callback()')
call s:run_server('Ch_test_close_callback')
endfunc
@@ -1495,7 +1490,6 @@
endfunc
func Test_close_partial()
- call ch_log('Test_close_partial()')
call s:run_server('Ch_test_close_partial')
endfunc
@@ -1712,7 +1706,6 @@
endfunc
func Test_close_lambda()
- call ch_log('Test_close_lambda()')
call s:run_server('Ch_test_close_lambda')
endfunc
@@ -1965,6 +1958,12 @@
endtry
endfunc
+func Test_empty_job()
+ " This was crashing on MS-Windows.
+ let job = job_start([""])
+ call WaitForAssert({-> assert_equal("dead", job_status(job))})
+endfunc
+
" Do this last, it stops any channel log.
func Test_zz_ch_log()
call ch_logfile('Xlog', 'w')
diff --git a/src/version.c b/src/version.c
index ec5c7b4..7d9b3db 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 29,
+/**/
28,
/**/
27,