]> granicus.if.org Git - vim/commitdiff
patch 8.2.2688: Vim9: crash when using s: for script variable v8.2.2688
authorBram Moolenaar <Bram@vim.org>
Thu, 1 Apr 2021 19:38:53 +0000 (21:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 1 Apr 2021 19:38:53 +0000 (21:38 +0200)
Problem:    Vim9: crash when using s: for script variable.
Solution:   Pass the end pointer. (closes #8045)

src/testdir/test_vim9_script.vim
src/version.c
src/vim9compile.c

index 0d49a42d9fd6f609c16799ffbeb826b13ffa05a9..cb1592abffb5aae31947dcba5004fdd41879282f 100644 (file)
@@ -1644,9 +1644,10 @@ def Test_vim9script_funcref()
 
     # using the function from a compiled function
     def TestMore(): string
-      return anAlias.GetString('text')
+      var s = s:anAlias.GetString('foo')
+      return s .. anAlias.GetString('bar')
     enddef
-    assert_equal('text', TestMore())
+    assert_equal('foobar', TestMore())
 
     # error when using a function that isn't exported
     assert_fails('anAlias.Compare(1, 2)', 'E1049:')
index 0fb8bc352386d24fac6714f5d7b594260809a192..7da1fc4fac264abf7fdb270d9249bd9828e25a34 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2688,
 /**/
     2687,
 /**/
index ca1c89cc15815719276ab641d5397bf695509ab0..3fb4a8d2051c0f1753b82c4ae307f966f5f73cfc 100644 (file)
@@ -2822,7 +2822,7 @@ compile_load(
                case 'v': res = generate_LOADV(cctx, name, error);
                          break;
                case 's': res = compile_load_scriptvar(cctx, name,
-                                                           NULL, NULL, error);
+                                                           NULL, &end, error);
                          break;
                case 'g': if (vim_strchr(name, AUTOLOAD_CHAR) == NULL)
                              isn_type = ISN_LOADG;