diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-08-28 12:30:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-08-28 12:30:12 +0200 |
commit | 271906bc067a8f25422016665001d2e44cf618e2 (patch) | |
tree | 83fee8240a2be83f321c8cee236caa7afbb427fb | |
parent | 6024c0427ce1196344439997d5e41a6f8546368c (diff) | |
download | vim-git-8.2.3379.tar.gz |
patch 8.2.3379: crash when using NULL jobv8.2.3379
Problem: Crash when using NULL job.
Solution: Copy static string into buffer. (issue #8260)
-rw-r--r-- | src/job.c | 5 | ||||
-rw-r--r-- | src/testdir/test_channel.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 10 insertions, 1 deletions
@@ -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"; diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 783a41d2c..fa510c7bb 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -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 = {} diff --git a/src/version.c b/src/version.c index a3f0a8db2..c2e07c668 100644 --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3379, +/**/ 3378, /**/ 3377, |