]> granicus.if.org Git - vim/commitdiff
patch 8.2.2148: Vim9: crash when user command doesn't match v8.2.2148
authorBram Moolenaar <Bram@vim.org>
Wed, 16 Dec 2020 20:43:54 +0000 (21:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 16 Dec 2020 20:43:54 +0000 (21:43 +0100)
Problem:    Vim9: crash when user command doesn't match.
Solution:   Adjust command index. (closes #7479)

src/ex_docmd.c
src/testdir/test_vim9_cmd.vim
src/version.c

index b08482232bf1cbcf98bbb31e19090c6d9fd78fc1..152eda6c6c2b96b1d4020de80aeedd557304e30a 100644 (file)
@@ -3520,7 +3520,7 @@ find_ex_command(
                ++p;
            p = find_ucmd(eap, p, full, NULL, NULL);
        }
-       if (p == eap->cmd)
+       if (p == NULL || p == eap->cmd)
            eap->cmdidx = CMD_SIZE;
     }
 
index 95d696913dbcceca492b72b7e7fb87fec15314fd..bdc9ad06da90c48267237dec668afe07dabad322 100644 (file)
@@ -701,5 +701,14 @@ def Test_cmd_argument_without_colon()
   delete('Xfile')
 enddef
 
+def Test_ambiguous_user_cmd()
+  var lines =<< trim END
+      com Cmd1 eval 0
+      com Cmd2 eval 0
+      Cmd
+  END
+  CheckScriptFailure(lines, 'E464:')
+enddef
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index f28bb4a43a16ba569b14c7de703ff5909f0e2769..a5c7127dc23d1345242b92886570383da92c34f0 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2148,
 /**/
     2147,
 /**/