forked from aniani/vim
patch 8.2.3379: crash when using NULL job
Problem: Crash when using NULL job. Solution: Copy static string into buffer. (issue #8260)
This commit is contained in:
@@ -1983,7 +1983,10 @@ job_to_string_buf(typval_T *varp, char_u *buf)
|
||||
char *status;
|
||||
|
||||
if (job == NULL)
|
||||
return (char_u *)"no process";
|
||||
{
|
||||
vim_snprintf((char *)buf, NUMBUFLEN, "no process");
|
||||
return buf;
|
||||
}
|
||||
status = job->jv_status == JOB_FAILED ? "fail"
|
||||
: job->jv_status >= JOB_ENDED ? "dead"
|
||||
: "run";
|
||||
|
||||
@@ -1718,6 +1718,10 @@ func Test_job_stop_immediately()
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_null_job_eval()
|
||||
call assert_fails('eval test_null_job()->eval()', 'E121:')
|
||||
endfunc
|
||||
|
||||
" This was leaking memory.
|
||||
func Test_partial_in_channel_cycle()
|
||||
let d = {}
|
||||
|
||||
@@ -755,6 +755,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
3379,
|
||||
/**/
|
||||
3378,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user