diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-13 21:29:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-13 21:29:32 +0100 |
commit | 21456cdccbdf9d222938139769f1abe95b8effdd (patch) | |
tree | d5d71fb7b621390690e1495e296da3f91d94eca1 /src | |
parent | 3dd64608f6183a49c6854652017b928556224935 (diff) |
patch 8.2.0253: crash when using :disassamble without argumentv8.2.0253
Problem: Crash when using :disassamble without argument. (Dhiraj Mishra)
Solution: Check for missing argument. (Dominique Pelle, closes #5635,
closes #5637)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds.h | 2 | ||||
-rw-r--r-- | src/testdir/test_vim9_disassemble.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9execute.c | 9 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 10b9ed7233..f09fb3bffa 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -479,7 +479,7 @@ EXCMD(CMD_digraphs, "digraphs", ex_digraphs, EX_BANG|EX_EXTRA|EX_TRLBAR|EX_CMDWIN, ADDR_NONE), EXCMD(CMD_disassemble, "disassemble", ex_disassemble, - EX_EXTRA|EX_TRLBAR|EX_CMDWIN, + EX_EXTRA|EX_NEEDARG|EX_TRLBAR|EX_CMDWIN, ADDR_NONE), EXCMD(CMD_djump, "djump", ex_findpat, EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA, diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim index d10e74148d..a873c86571 100644 --- a/src/testdir/test_vim9_disassemble.vim +++ b/src/testdir/test_vim9_disassemble.vim @@ -23,6 +23,10 @@ enddef def Test_disassemble_load() assert_fails('disass NoFunc', 'E1061:') assert_fails('disass NotCompiled', 'E1062:') + assert_fails('disass', 'E471:') + assert_fails('disass [', 'E475:') + assert_fails('disass 234', 'E475:') + assert_fails('disass <XX>foo', 'E475:') let res = execute('disass s:ScriptFuncLoad') assert_match('<SNR>\d*_ScriptFuncLoad.*' diff --git a/src/version.c b/src/version.c index 8ebbf491c5..0499e5da19 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 253, +/**/ 252, /**/ 251, diff --git a/src/vim9execute.c b/src/vim9execute.c index ed3a75b106..c31506a86d 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1590,6 +1590,7 @@ failed: void ex_disassemble(exarg_T *eap) { + char_u *arg = eap->arg; char_u *fname; ufunc_T *ufunc; dfunc_T *dfunc; @@ -1598,8 +1599,14 @@ ex_disassemble(exarg_T *eap) int line_idx = 0; int prev_current = 0; - fname = trans_function_name(&eap->arg, FALSE, + fname = trans_function_name(&arg, FALSE, TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD | TFN_NO_DEREF, NULL, NULL); + if (fname == NULL) + { + semsg(_(e_invarg2), eap->arg); + return; + } + ufunc = find_func(fname, NULL); vim_free(fname); if (ufunc == NULL) |