Patch 8.2.1848
Problem: Crash when passing a NULL string or list to popup_settext().
Solution: Check for NULL pointers. (closes #7132)
Files: src/popupwin.c, src/testdir/test_popupwin.vim
*** ../vim-8.2.1847/src/popupwin.c 2020-09-27 21:16:41.760046900 +0200
--- src/popupwin.c 2020-10-15 19:09:26.239855116 +0200
***************
*** 1595,1608 ****
// Add text to the buffer.
if (text.v_type == VAR_STRING)
{
// just a string
! ml_append_buf(buf, 0, text.vval.v_string, (colnr_T)0, TRUE);
}
else
{
list_T *l = text.vval.v_list;
! if (l->lv_len > 0)
{
if (l->lv_first->li_tv.v_type == VAR_STRING)
// list of strings
--- 1595,1610 ----
// Add text to the buffer.
if (text.v_type == VAR_STRING)
{
+ char_u *s = text.vval.v_string;
+
// just a string
! ml_append_buf(buf, 0, s == NULL ? (char_u *)"" : s, (colnr_T)0, TRUE);
}
else
{
list_T *l = text.vval.v_list;
! if (l != NULL && l->lv_len > 0)
{
if (l->lv_first->li_tv.v_type == VAR_STRING)
// list of strings
*** ../vim-8.2.1847/src/testdir/test_popupwin.vim 2020-10-06
20:46:43.767871541 +0200
--- src/testdir/test_popupwin.vim 2020-10-15 19:09:13.523891438 +0200
***************
*** 2363,2368 ****
--- 2363,2378 ----
call popup_close(id)
endfunc
+ func Test_popup_settext_null()
+ let id = popup_create('', #{ tabpage: 0 })
+ call popup_settext(id, test_null_list())
+ call popup_close(id)
+
+ let id = popup_create('', #{ tabpage: 0 })
+ call popup_settext(id, test_null_string())
+ call popup_close(id)
+ endfunc
+
func Test_popup_hidden()
new
*** ../vim-8.2.1847/src/version.c 2020-10-15 13:57:52.098225999 +0200
--- src/version.c 2020-10-15 19:03:28.332875888 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1848,
/**/
--
>From "know your smileys":
:-O>-o Smiley American tourist (note big mouth and camera)
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202010151711.09FHBhwv120161%40masaka.moolenaar.net.