Mercurial > vim
changeset 25686:838a0108a92d v8.2.3379
patch 8.2.3379: crash when using NULL job
Commit: https://github.com/vim/vim/commit/271906bc067a8f25422016665001d2e44cf618e2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 28 12:30:12 2021 +0200
patch 8.2.3379: crash when using NULL job
Problem: Crash when using NULL job.
Solution: Copy static string into buffer. (issue https://github.com/vim/vim/issues/8260)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Aug 2021 12:45:06 +0200 |
parents | 6d11c7a81208 |
children | dff7f4a5740c |
files | src/job.c src/testdir/test_channel.vim src/version.c |
diffstat | 3 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/job.c +++ b/src/job.c @@ -1983,7 +1983,10 @@ job_to_string_buf(typval_T *varp, char_u 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";
--- 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 = {}