]> granicus.if.org Git - vim/commitdiff
patch 8.2.0735: Vim9: using unitialized memory v8.2.0735
authorBram Moolenaar <Bram@vim.org>
Sun, 10 May 2020 21:20:06 +0000 (23:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 10 May 2020 21:20:06 +0000 (23:20 +0200)
Problem:    Vim9: using unitialized memory.
Solution:   Clear the arg_lvar field.

src/version.c
src/vim9compile.c

index 19920dea8762121d325e4409a0acbd11690cf7e0..96ca8898ae6085721684ea88fa8f9d93fc8541c6 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    735,
 /**/
     734,
 /**/
index c8c87e737f6abcb78aad31f4a2620f0a4616661a..99246e07dfdbffd595e75bb9923237b8a0456d83 100644 (file)
@@ -4762,18 +4762,20 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
                }
 
            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)
            {