Skip to content

Commit

Permalink
patch 8.2.0253: crash when using :disassamble without argument
Browse files Browse the repository at this point in the history
Problem:    Crash when using :disassamble without argument. (Dhiraj Mishra)
Solution:   Check for missing argument. (Dominique Pelle, closes #5635,
            closes #5637)
  • Loading branch information
brammool committed Feb 13, 2020
1 parent 3dd6460 commit 21456cd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ex_cmds.h
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/testdir/test_vim9_disassemble.vim
Expand Up @@ -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.*'
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -742,6 +742,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
253,
/**/
252,
/**/
Expand Down
9 changes: 8 additions & 1 deletion src/vim9execute.c
Expand Up @@ -1590,6 +1590,7 @@ call_def_function(
void
ex_disassemble(exarg_T *eap)
{
char_u *arg = eap->arg;
char_u *fname;
ufunc_T *ufunc;
dfunc_T *dfunc;
Expand All @@ -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)
Expand Down

0 comments on commit 21456cd

Please sign in to comment.