To: vim_dev@googlegroups.com Subject: Patch 8.1.1296 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1296 Problem: Crash when using invalid command line argument. Solution: Check for options not being initialized. Files: src/term.c, src/testdir/test_startup.vim *** ../vim-8.1.1295/src/term.c 2019-05-04 16:58:41.613537362 +0200 --- src/term.c 2019-05-08 16:36:20.371184451 +0200 *************** *** 3014,3026 **** void term_push_title(int which) { ! if ((which & SAVE_RESTORE_TITLE) && *T_CST != NUL) { OUT_STR(T_CST); out_flush(); } ! if ((which & SAVE_RESTORE_ICON) && *T_SSI != NUL) { OUT_STR(T_SSI); out_flush(); --- 3014,3026 ---- void term_push_title(int which) { ! if ((which & SAVE_RESTORE_TITLE) && T_CST != NULL && *T_CST != NUL) { OUT_STR(T_CST); out_flush(); } ! if ((which & SAVE_RESTORE_ICON) && T_SSI != NULL && *T_SSI != NUL) { OUT_STR(T_SSI); out_flush(); *************** *** 3033,3045 **** void term_pop_title(int which) { ! if ((which & SAVE_RESTORE_TITLE) && *T_CRT != NUL) { OUT_STR(T_CRT); out_flush(); } ! if ((which & SAVE_RESTORE_ICON) && *T_SRI != NUL) { OUT_STR(T_SRI); out_flush(); --- 3033,3045 ---- void term_pop_title(int which) { ! if ((which & SAVE_RESTORE_TITLE) && T_CRT != NULL && *T_CRT != NUL) { OUT_STR(T_CRT); out_flush(); } ! if ((which & SAVE_RESTORE_ICON) && T_SRI != NULL && *T_SRI != NUL) { OUT_STR(T_SRI); out_flush(); *** ../vim-8.1.1295/src/testdir/test_startup.vim 2019-05-07 22:10:47.082118240 +0200 --- src/testdir/test_startup.vim 2019-05-08 16:39:13.558191165 +0200 *************** *** 408,419 **** endfor if has('clientserver') - " FIXME: need to add --servername to this list - " but it causes vim-8.1.1282 to crash! for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr', \ '--remote-tab', '--remote-tab-wait', \ '--remote-tab-wait-silent', '--remote-tab-silent', \ '--remote-wait', '--remote-wait-silent', \ ] let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") call assert_equal(1, v:shell_error) --- 408,418 ---- endfor if has('clientserver') for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr', \ '--remote-tab', '--remote-tab-wait', \ '--remote-tab-wait-silent', '--remote-tab-silent', \ '--remote-wait', '--remote-wait-silent', + \ '--servername', \ ] let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") call assert_equal(1, v:shell_error) *************** *** 423,436 **** endfor endif ! " FIXME: commented out as this causes vim-8.1.1282 to crash! ! "if has('clipboard') ! " let out = split(system(GetVimCommand() .. ' --display'), "\n") ! " call assert_equal(1, v:shell_error) ! " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) ! " call assert_equal('Argument missing after: "--display"', out[1]) ! " call assert_equal('More info with: "vim -h"', out[2]) ! "endif let out = split(system(GetVimCommand() .. ' -ix'), "\n") call assert_equal(1, v:shell_error) --- 422,434 ---- endfor endif ! if has('clipboard') ! let out = split(system(GetVimCommand() .. ' --display'), "\n") ! call assert_equal(1, v:shell_error) ! call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) ! call assert_equal('Argument missing after: "--display"', out[1]) ! call assert_equal('More info with: "vim -h"', out[2]) ! endif let out = split(system(GetVimCommand() .. ' -ix'), "\n") call assert_equal(1, v:shell_error) *************** *** 463,478 **** call assert_equal('More info with: "vim -h"', out[2]) endfor ! " FIXME: commented out as this causes vim-8.1.1282 to crash! ! "if has('gui_gtk') ! " for opt in ['--socketid x', '--socketid 0xg'] ! " let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") ! " call assert_equal(1, v:shell_error) ! " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) ! " call assert_equal('Invalid argument for: "--socketid"', out[1]) ! " call assert_equal('More info with: "vim -h"', out[2]) ! " endfor ! "endif endfunc func Test_file_args() --- 461,475 ---- call assert_equal('More info with: "vim -h"', out[2]) endfor ! if has('gui_gtk') ! for opt in ['--socketid x', '--socketid 0xg'] ! let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") ! call assert_equal(1, v:shell_error) ! call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) ! call assert_equal('Invalid argument for: "--socketid"', out[1]) ! call assert_equal('More info with: "vim -h"', out[2]) ! endfor ! endif endfunc func Test_file_args() *** ../vim-8.1.1295/src/version.c 2019-05-07 23:01:34.241209371 +0200 --- src/version.c 2019-05-08 16:37:45.622695748 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1296, /**/ -- "Software is like sex... it's better when it's free." -- Linus Torvalds, initiator of the free Linux OS Makes me wonder what FSF stands for...? /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///