changeset 23541:a2a38bc68dd9 v8.2.2313

patch 8.2.2313: Vim9: using uninitialized field when parsing range Commit: https://github.com/vim/vim/commit/ece0b87c0fb0e35ff4c51f9ba81389f56428e42b Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 8 20:40:45 2021 +0100 patch 8.2.2313: Vim9: using uninitialized field when parsing range Problem: Vim9: using uninitialized field when parsing range. ":silent!" not respected when parsing range fails. Solution: Initialize ea.skip. On pattern failure handle it like an error. (closes #7636)
author Bram Moolenaar <Bram@vim.org>
date Fri, 08 Jan 2021 20:45:03 +0100
parents f13918b6b8de
children 4ad827c071b9
files src/testdir/test_vim9_cmd.vim src/version.c src/vim9execute.c
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -661,6 +661,12 @@ def Test_range_after_command_modifier()
   bwipe!
 enddef
 
+def Test_silent_pattern()
+  new
+  silent! :/pat/put _
+  bwipe!
+enddef
+
 def Test_eval_command()
   var from = 3
   var to = 5
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2313,
+/**/
     2312,
 /**/
     2311,
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3148,11 +3148,13 @@ call_def_function(
 			goto failed;
 		    ++ectx.ec_stack.ga_len;
 		    tv = STACK_TV_BOT(-1);
+		    ea.line2 = 0;
 		    ea.addr_count = 0;
 		    ea.addr_type = ADDR_LINES;
 		    ea.cmd = iptr->isn_arg.string;
+		    ea.skip = FALSE;
 		    if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL)
-			goto failed;
+			goto on_error;
 		    if (ea.addr_count == 0)
 			tv->vval.v_number = curwin->w_cursor.lnum;
 		    else