]> granicus.if.org Git - vim/commitdiff
patch 8.2.0117: crash when using gettabwinvar() with invalid arguments v8.2.0117
authorBram Moolenaar <Bram@vim.org>
Tue, 14 Jan 2020 18:05:39 +0000 (19:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 14 Jan 2020 18:05:39 +0000 (19:05 +0100)
Problem:    Crash when using gettabwinvar() with invalid arguments. (Yilin
            Yang)
Solution:   Use "curtab" if "tp" is NULL. (closes #5475)

src/evalwindow.c
src/testdir/test_getvar.vim
src/version.c

index 672bfc13c959e35714ccf3c69ea811f0d2f5c6e0..fb54033e5e925cb9385059f80b1e89dcb4c563ce 100644 (file)
@@ -183,7 +183,8 @@ find_win_by_nr(
     {
 #ifdef FEAT_PROP_POPUP
        // check tab-local popup windows
-       for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)
+       for (wp = (tp == NULL ? curtab : tp)->tp_first_popupwin;
+                                                  wp != NULL; wp = wp->w_next)
            if (wp->w_id == nr)
                return wp;
        // check global popup windows
index 5a965488932ffb084fb5a255e50c6d80c942db44..5da5991361283d076fb195312331bf4a5acb0155 100644 (file)
@@ -83,6 +83,7 @@ func Test_var()
 
   unlet def_dict
 
+  call assert_equal("", gettabwinvar(9, 2020, ''))
   call assert_equal('', gettabwinvar(2, 3, '&nux'))
   call assert_equal(1, gettabwinvar(2, 3, '&nux', 1))
   tabonly
index 1e79e03c681101fb35e2ead0d5724bb5b1a78aa7..25049a0ffab458770e56cab783663c74cf43dbe6 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    117,
 /**/
     116,
 /**/