0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.2302: Vim9: using an option value may use uninitialized memory

Problem:    Vim9: using an option value may use uninitialized memory.
Solution:   Clear v_lock. (closes #7620)
This commit is contained in:
Bram Moolenaar 2021-01-05 17:50:28 +01:00
parent 752fc692ac
commit a79925a0a8
3 changed files with 12 additions and 0 deletions

View File

@ -2426,6 +2426,10 @@ def Test_expr_member_vim9script()
CheckScriptSuccess(lines) CheckScriptSuccess(lines)
enddef enddef
def SetSomeVar()
b:someVar = &fdm
enddef
def Test_expr7_option() def Test_expr7_option()
# option # option
set ts=11 set ts=11
@ -2443,6 +2447,11 @@ def Test_expr7_option()
var bval: bool = &tgc var bval: bool = &tgc
var nval: number = &ts var nval: number = &ts
var sval: string = &path var sval: string = &path
# check v_lock is cleared (requires using valgrind, doesn't always show)
SetSomeVar()
b:someVar = 0
unlet b:someVar
enddef enddef
def Test_expr7_environment() def Test_expr7_environment()

View File

@ -1117,6 +1117,7 @@ eval_option(
} }
else if (rettv != NULL) else if (rettv != NULL)
{ {
rettv->v_lock = 0;
if (opt_type == gov_hidden_string) if (opt_type == gov_hidden_string)
{ {
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2302,
/**/ /**/
2301, 2301,
/**/ /**/