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 -- [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/202101051650.105GowY92805434%40masaka.moolenaar.net.

Raspunde prin e-mail lui