diff options
-rw-r--r-- | src/nvim/window.c | 3 | ||||
-rw-r--r-- | test/old/testdir/crash/poc1 | bin | 0 -> 3264 bytes | |||
-rw-r--r-- | test/old/testdir/crash/poc_huaf1 | bin | 0 -> 1541 bytes | |||
-rw-r--r-- | test/old/testdir/crash/poc_huaf2 | bin | 0 -> 3238 bytes | |||
-rw-r--r-- | test/old/testdir/crash/poc_huaf3 | bin | 0 -> 4053 bytes | |||
-rw-r--r-- | test/old/testdir/crash/vim_regsub_both_poc | bin | 0 -> 244 bytes | |||
-rw-r--r-- | test/old/testdir/test_crash.vim | 33 |
7 files changed, 36 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 89bdd7f5e0..00524b2f56 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2661,6 +2661,9 @@ int win_close(win_T *win, bool free_buf, bool force) reset_VIsual_and_resel(); // stop Visual mode other_buffer = true; + if (!win_valid(win)) { + return FAIL; + } win->w_closing = true; apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf); if (!win_valid(win)) { diff --git a/test/old/testdir/crash/poc1 b/test/old/testdir/crash/poc1 Binary files differnew file mode 100644 index 0000000000..ec223f16b8 --- /dev/null +++ b/test/old/testdir/crash/poc1 diff --git a/test/old/testdir/crash/poc_huaf1 b/test/old/testdir/crash/poc_huaf1 Binary files differnew file mode 100644 index 0000000000..0d0ea475c1 --- /dev/null +++ b/test/old/testdir/crash/poc_huaf1 diff --git a/test/old/testdir/crash/poc_huaf2 b/test/old/testdir/crash/poc_huaf2 Binary files differnew file mode 100644 index 0000000000..4867e0f956 --- /dev/null +++ b/test/old/testdir/crash/poc_huaf2 diff --git a/test/old/testdir/crash/poc_huaf3 b/test/old/testdir/crash/poc_huaf3 Binary files differnew file mode 100644 index 0000000000..7e38a9a17c --- /dev/null +++ b/test/old/testdir/crash/poc_huaf3 diff --git a/test/old/testdir/crash/vim_regsub_both_poc b/test/old/testdir/crash/vim_regsub_both_poc Binary files differnew file mode 100644 index 0000000000..19a57114be --- /dev/null +++ b/test/old/testdir/crash/vim_regsub_both_poc diff --git a/test/old/testdir/test_crash.vim b/test/old/testdir/test_crash.vim index 5cd07e2a3f..b093b053c5 100644 --- a/test/old/testdir/test_crash.vim +++ b/test/old/testdir/test_crash.vim @@ -110,6 +110,39 @@ func Test_crash1() call delete('X_crash1_result.txt') endfunc +func Test_crash1_2() + CheckNotBSD + CheckExecutable dash + + " The following used to crash Vim + let opts = #{cmd: 'sh'} + let vim = GetVimProg() + let result = 'X_crash1_1_result.txt' + + let buf = RunVimInTerminal('sh', opts) + + let file = 'crash/poc1' + let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args .. + \ ' && echo "crash 1: [OK]" > '.. result .. "\<cr>") + call TermWait(buf, 150) + + " clean up + exe buf .. "bw!" + + exe "sp " .. result + + let expected = [ + \ 'crash 1: [OK]', + \ ] + + call assert_equal(expected, getline(1, '$')) + bw! + + call delete(result) +endfunc + func Test_crash2() " The following used to crash Vim let opts = #{wait_for_ruler: 0, rows: 20} |