From: Bram Moolenaar Date: Tue, 5 Jan 2021 16:50:28 +0000 (+0100) Subject: patch 8.2.2302: Vim9: using an option value may use uninitialized memory X-Git-Tag: v8.2.2302 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a79925a0a8f00577782090859eb0ef69e220d4aa;p=thirdparty%2Fvim.git 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) --- diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index 4941650650..d835f04a96 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -2426,6 +2426,10 @@ def Test_expr_member_vim9script() CheckScriptSuccess(lines) enddef +def SetSomeVar() + b:someVar = &fdm +enddef + def Test_expr7_option() # option set ts=11 @@ -2443,6 +2447,11 @@ def Test_expr7_option() 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() diff --git a/src/typval.c b/src/typval.c index 421e62a37c..d16f0e6df8 100644 --- a/src/typval.c +++ b/src/typval.c @@ -1117,6 +1117,7 @@ eval_option( } else if (rettv != NULL) { + rettv->v_lock = 0; if (opt_type == gov_hidden_string) { rettv->v_type = VAR_STRING; diff --git a/src/version.c b/src/version.c index c01221cc6c..e7c3ee0a0d 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2302, /**/ 2301, /**/