changeset 20359:fad124c0e349 v8.2.0735

patch 8.2.0735: Vim9: using unitialized memory Commit: https://github.com/vim/vim/commit/bc38f25c021dc4314c77d50a608329a328b0d988 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 10 23:20:06 2020 +0200 patch 8.2.0735: Vim9: using unitialized memory Problem: Vim9: using unitialized memory. Solution: Clear the arg_lvar field.
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 May 2020 23:30:03 +0200
parents a30777aed380
children 0af966ee7337
files src/version.c src/vim9compile.c
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    735,
+/**/
     734,
 /**/
     733,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4762,18 +4762,20 @@ compile_assignment(char_u *arg, exarg_T 
 		}
 
 	    lvar = lookup_local(arg, varlen, cctx);
-	    if (lvar == NULL
-		    && lookup_arg(arg, varlen,
+	    if (lvar == NULL)
+	    {
+		CLEAR_FIELD(arg_lvar);
+		if (lookup_arg(arg, varlen,
 			    &arg_lvar.lv_idx, &arg_lvar.lv_type,
 			    &arg_lvar.lv_from_outer, cctx) == OK)
-	    {
-		if (is_decl)
 		{
-		    semsg(_(e_used_as_arg), name);
-		    goto theend;
+		    if (is_decl)
+		    {
+			semsg(_(e_used_as_arg), name);
+			goto theend;
+		    }
+		    lvar = &arg_lvar;
 		}
-		arg_lvar.lv_const = 0;
-		lvar = &arg_lvar;
 	    }
 	    if (lvar != NULL)
 	    {