Patch 8.2.2302
Problem: Vim9: using an option value may use uninitialized memory.
Solution: Clear v_lock. (closes #7620)
Files: src/typval.c, src/testdir/test_vim9_expr.vim
*** ../vim-8.2.2301/src/typval.c 2020-12-31 17:40:57.536087870 +0100
--- src/typval.c 2021-01-05 17:49:06.005599771 +0100
***************
*** 1117,1122 ****
--- 1117,1123 ----
}
else if (rettv != NULL)
{
+ rettv->v_lock = 0;
if (opt_type == gov_hidden_string)
{
rettv->v_type = VAR_STRING;
*** ../vim-8.2.2301/src/testdir/test_vim9_expr.vim 2021-01-04 17:40:08.422342256 +0100
--- src/testdir/test_vim9_expr.vim 2021-01-05 17:48:55.773638665 +0100
***************
*** 2426,2431 ****
--- 2426,2435 ----
CheckScriptSuccess(lines)
enddef
+ def SetSomeVar()
+ b:someVar = &fdm
+ enddef
+
def Test_expr7_option()
# option
set ts=11
***************
*** 2443,2448 ****
--- 2447,2457 ----
var bval: bool = &tgc
var nval: number = &ts
var sval: string = &path
+
+ # check v_lock is cleared (requires using valgrind, doesn't always show)
+ SetSomeVar()
+ b:someVar = 0
+ unlet b:someVar
enddef
def Test_expr7_environment()
*** ../vim-8.2.2301/src/version.c 2021-01-04 21:57:08.088222062 +0100
--- src/version.c 2021-01-05 17:50:08.717362614 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2302,
/**/
--
I AM THANKFUL...
...for the piles of laundry and ironing because it means I
have plenty of clothes to wear.
/// Bram Moolenaar -- Br...@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 ///