]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3479: crash when calling job_start with an invalid argument v8.2.3479
authorBram Moolenaar <Bram@vim.org>
Tue, 5 Oct 2021 18:19:35 +0000 (19:19 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 5 Oct 2021 18:19:35 +0000 (19:19 +0100)
Problem:    Crash when calling job_start with an invalid argument. (Virginia
            Senioria)
Solution:   Clear the first item in argv. (closes #8957)

src/misc2.c
src/testdir/test_channel.vim
src/version.c

index 2436f9fb06d454aaf46230d102cc8ca6942b3145..8e01434eae00ef01c397866f13f87c02b55e4857 100644 (file)
@@ -2953,6 +2953,7 @@ build_argv_from_list(list_T *l, char ***argv, int *argc)
 
            for (i = 0; i < *argc; ++i)
                VIM_CLEAR((*argv)[i]);
+           (*argv)[0] = NULL;
            return FAIL;
        }
        (*argv)[*argc] = (char *)vim_strsave(s);
index fa510c7bbcce300f0f01b29a52f526fbe0734baf..fbe6a842876c3a28db4a64c9c20bd1524d43166e 100644 (file)
@@ -2362,5 +2362,9 @@ func Test_parse_messages_in_autocmd()
   augroup END
 endfunc
 
+func Test_job_start_with_invalid_argument()
+  call assert_fails('call job_start([0zff])', 'E976:')
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index fa64466568f91bcc6cd671f5b01f5425c40cff90..96e760605681a2da59e81c30d7af4791601f2e4b 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3479,
 /**/
     3478,
 /**/