To: vim_dev@googlegroups.com Subject: Patch 8.1.1709 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1709 Problem: Coverity warns for possibly using a NULL pointer. Solution: Make sure no NULL pointer is used. Files: src/popupwin.c, src/testdir/test_popupwin.vim *** ../vim-8.1.1708/src/popupwin.c 2019-07-17 21:27:48.822903817 +0200 --- src/popupwin.c 2019-07-17 21:36:11.280955516 +0200 *************** *** 516,522 **** di = dict_find(dict, (char_u *)"borderhighlight", -1); if (di != NULL) { ! if (di->di_tv.v_type != VAR_LIST) emsg(_(e_listreq)); else { --- 516,522 ---- di = dict_find(dict, (char_u *)"borderhighlight", -1); if (di != NULL) { ! if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL) emsg(_(e_listreq)); else { *************** *** 524,540 **** listitem_T *li; int i; ! if (list != NULL) ! for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; ! ++i, li = li->li_next) ! { ! str = tv_get_string(&li->li_tv); ! if (*str != NUL) ! wp->w_border_highlight[i] = vim_strsave(str); ! } if (list->lv_len == 1 && wp->w_border_highlight[0] != NULL) for (i = 1; i < 4; ++i) ! wp->w_border_highlight[i] = vim_strsave(wp->w_border_highlight[0]); } } --- 524,539 ---- listitem_T *li; int i; ! for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; ! ++i, li = li->li_next) ! { ! str = tv_get_string(&li->li_tv); ! if (*str != NUL) ! wp->w_border_highlight[i] = vim_strsave(str); ! } if (list->lv_len == 1 && wp->w_border_highlight[0] != NULL) for (i = 1; i < 4; ++i) ! wp->w_border_highlight[i] = vim_strsave(wp->w_border_highlight[0]); } } *** ../vim-8.1.1708/src/testdir/test_popupwin.vim 2019-07-17 21:27:48.826903797 +0200 --- src/testdir/test_popupwin.vim 2019-07-17 21:34:42.329183133 +0200 *************** *** 634,639 **** --- 634,641 ---- call popup_clear() call assert_fails('call popup_create("text", #{borderhighlight: "none"})', 'E714:') call popup_clear() + call assert_fails('call popup_create("text", #{borderhighlight: test_null_list()})', 'E714:') + call popup_clear() call assert_fails('call popup_create("text", #{borderchars: "none"})', 'E714:') call popup_clear() *** ../vim-8.1.1708/src/version.c 2019-07-17 21:32:10.717608653 +0200 --- src/version.c 2019-07-17 21:36:55.012832731 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1709, /**/ -- It is illegal for anyone to give lighted cigars to dogs, cats, and other domesticated animal kept as pets. [real standing law in Illinois, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///