mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0167: terminal: setting buftype=terminal may cause a crash
Problem: setting buftype=terminal may cause a crash
(lacygoill, after v9.2.0127)
Solution: Validate that curwin->w_buffer->b_term is not null
fixes: #19686
closes: #19676
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
+2
-2
@@ -6984,7 +6984,7 @@ var2fpos(
|
||||
if (name[1] == '0') // "w0": first visible line
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (bt_terminal(curwin->w_buffer))
|
||||
if (bt_terminal(curwin->w_buffer) && curwin->w_buffer->b_term != NULL)
|
||||
may_move_terminal_to_buffer(curwin->w_buffer->b_term, TRUE);
|
||||
#endif
|
||||
update_topline();
|
||||
@@ -6996,7 +6996,7 @@ var2fpos(
|
||||
else if (name[1] == '$') // "w$": last visible line
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (bt_terminal(curwin->w_buffer))
|
||||
if (bt_terminal(curwin->w_buffer) && curwin->w_buffer->b_term != NULL)
|
||||
may_move_terminal_to_buffer(curwin->w_buffer->b_term, TRUE);
|
||||
#endif
|
||||
validate_botline();
|
||||
|
||||
@@ -1203,6 +1203,11 @@ func Test_term_getpos()
|
||||
call assert_true(str2nr(result[0]) > 1)
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
" this crashed
|
||||
new
|
||||
setl buftype=terminal
|
||||
call assert_equal(2, line('w0') + line('w$'))
|
||||
bw
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
167,
|
||||
/**/
|
||||
166,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user