Patch 8.0.1429
Problem: Crash when calling term_start() with empty argument.
Solution: Check for invalid argument. (Yasuhiro Matsomoto, closes #2503)
Fix memory leak.
Files: src/terminal.c, src/testdir/test_terminal.vim
*** ../vim-8.0.1428/src/terminal.c 2017-12-05 21:32:28.943651550 +0100
--- src/terminal.c 2018-01-26 20:02:29.294783413 +0100
***************
*** 42,47 ****
--- 42,48 ----
* a job that uses 16 colors while Vim is using > 256.
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
* Higashi, 2017 Sep 19)
+ * - Trigger TerminalOpen event? #2422 patch in #2484
* - Shift-Tab does not work.
* - after resizing windows overlap. (Boris Staletic, #2164)
* - Redirecting output does not work on MS-Windows,
Test_terminal_redir_file()
***************
*** 62,67 ****
--- 63,70 ----
* - add test for giving error for invalid 'termsize' value.
* - support minimal size when 'termsize' is "rows*cols".
* - support minimal size when 'termsize' is empty?
+ * - if the job in the terminal does not support the mouse, we can use the
+ * mouse in the Terminal window for copy/paste and scrolling.
* - GUI: when using tabs, focus in terminal, click on tab does not work.
* - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save
* changes to "!shell".
***************
*** 69,76 ****
* - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed)
* - For the GUI fill termios with default values, perhaps like pangoterm:
*
http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134
- * - if the job in the terminal does not support the mouse, we can use the
- * mouse in the Terminal window for copy/paste.
* - when 'encoding' is not utf-8, or the job is using another encoding, setup
* conversions.
* - In the GUI use a terminal emulator for :!cmd. Make the height the same
as
--- 72,77 ----
***************
*** 3388,3415 ****
void *winpty_err;
void *spawn_config = NULL;
garray_T ga_cmd, ga_env;
! char_u *cmd;
if (dyn_winpty_init(TRUE) == FAIL)
return FAIL;
if (argvar->v_type == VAR_STRING)
cmd = argvar->vval.v_string;
! else
{
- ga_init2(&ga_cmd, (int)sizeof(char*), 20);
if (win32_build_cmd(argvar->vval.v_list, &ga_cmd) == FAIL)
goto failed;
cmd = ga_cmd.ga_data;
}
cmd_wchar = enc_to_utf16(cmd, NULL);
if (cmd_wchar == NULL)
! return FAIL;
if (opt->jo_cwd != NULL)
cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
- ga_init2(&ga_env, (int)sizeof(char*), 20);
win32_build_env(opt->jo_env, &ga_env, TRUE);
env_wchar = ga_env.ga_data;
--- 3389,3424 ----
void *winpty_err;
void *spawn_config = NULL;
garray_T ga_cmd, ga_env;
! char_u *cmd = NULL;
if (dyn_winpty_init(TRUE) == FAIL)
return FAIL;
+ ga_init2(&ga_cmd, (int)sizeof(char*), 20);
+ ga_init2(&ga_env, (int)sizeof(char*), 20);
if (argvar->v_type == VAR_STRING)
+ {
cmd = argvar->vval.v_string;
! }
! else if (argvar->v_type == VAR_LIST)
{
if (win32_build_cmd(argvar->vval.v_list, &ga_cmd) == FAIL)
goto failed;
cmd = ga_cmd.ga_data;
}
+ if (cmd == NULL || *cmd == NUL)
+ {
+ EMSG(_(e_invarg));
+ goto failed;
+ }
cmd_wchar = enc_to_utf16(cmd, NULL);
+ ga_clear(&ga_cmd);
if (cmd_wchar == NULL)
! goto failed;
if (opt->jo_cwd != NULL)
cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
win32_build_env(opt->jo_env, &ga_env, TRUE);
env_wchar = ga_env.ga_data;
***************
*** 3490,3495 ****
--- 3499,3505 ----
winpty_spawn_config_free(spawn_config);
vim_free(cmd_wchar);
vim_free(cwd_wchar);
+ vim_free(env_wchar);
create_vterm(term, term->tl_rows, term->tl_cols);
***************
*** 3511,3519 ****
return OK;
failed:
! if (argvar->v_type == VAR_LIST)
! vim_free(ga_cmd.ga_data);
! vim_free(ga_env.ga_data);
vim_free(cmd_wchar);
vim_free(cwd_wchar);
if (spawn_config != NULL)
--- 3521,3528 ----
return OK;
failed:
! ga_clear(&ga_cmd);
! ga_clear(&ga_env);
vim_free(cmd_wchar);
vim_free(cwd_wchar);
if (spawn_config != NULL)
*** ../vim-8.0.1428/src/testdir/test_terminal.vim 2017-12-05
12:29:57.454648456 +0100
--- src/testdir/test_terminal.vim 2018-01-26 19:34:31.473618633 +0100
***************
*** 795,797 ****
--- 795,808 ----
au! repro
delfunc Nop
endfunc
+
+ func Test_terminal_term_start_empty_command()
+ let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})"
+ call assert_fails(cmd, 'E474')
+ let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})"
+ call assert_fails(cmd, 'E474')
+ let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})"
+ call assert_fails(cmd, 'E474')
+ let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})"
+ call assert_fails(cmd, 'E474')
+ endfunc
*** ../vim-8.0.1428/src/version.c 2018-01-02 15:37:42.370832263 +0100
--- src/version.c 2018-01-26 20:03:54.314237992 +0100
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1429,
/**/
--
Married is a three ring circus:
First comes the engagement ring.
Then comes the wedding ring.
Then comes the suffering.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.