vim-patch:8.0.0083

Problem:    Using freed memory with win_getid(). (Domenique Pelle)
Solution:   For the current tab use curwin.

8e63905263
This commit is contained in:
Justin M. Keyes 2017-03-21 19:23:12 +01:00
parent 9c8540edfd
commit b82e3358e0
2 changed files with 14 additions and 1 deletions

View File

@ -92,3 +92,12 @@ func Test_win_getid()
only!
endfunc
func Test_win_getid_curtab()
tabedit X
tabfirst
copen
only
call assert_equal(win_getid(1), win_getid(1, 1))
tabclose!
endfunc

View File

@ -5821,7 +5821,11 @@ int win_getid(typval_T *argvars)
if (tp == NULL) {
return -1;
}
wp = tp->tp_firstwin;
if (tp == curtab) {
wp = firstwin;
} else {
wp = tp->tp_firstwin;
}
}
for ( ; wp != NULL; wp = wp->w_next) {
if (--winnr == 0) {