Skip to content

Commit 8e63905

Browse files
committed
patch 8.0.0083
Problem: Using freed memory with win_getid(). (Domenique Pelle) Solution: For the current tab use curwin.
1 parent 3f7d090 commit 8e63905

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/testdir/test_window_id.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,12 @@ func Test_win_getid()
9292

9393
only!
9494
endfunc
95+
96+
func Test_win_getid_curtab()
97+
tabedit X
98+
tabfirst
99+
copen
100+
only
101+
call assert_equal(win_getid(1), win_getid(1, 1))
102+
tabclose!
103+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
83,
767769
/**/
768770
82,
769771
/**/

src/window.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7133,7 +7133,10 @@ win_getid(typval_T *argvars)
71337133
break;
71347134
if (tp == NULL)
71357135
return -1;
7136-
wp = tp->tp_firstwin;
7136+
if (tp == curtab)
7137+
wp = firstwin;
7138+
else
7139+
wp = tp->tp_firstwin;
71377140
}
71387141
for ( ; wp != NULL; wp = wp->w_next)
71397142
if (--winnr == 0)

0 commit comments

Comments
 (0)