Skip to content

Commit

Permalink
patch 8.2.3134: crash when using typename() on a function reference
Browse files Browse the repository at this point in the history
Problem:    Crash when using typename() on a function reference. (Naohiro Ono)
Solution:   Initialize pointer to NULL. (closes #8531)
  • Loading branch information
brammool committed Jul 9, 2021
1 parent 90fba56 commit 9da32e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/testdir/test_vim9_builtin.vim
Expand Up @@ -1943,6 +1943,12 @@ def Test_tr()
CheckDefFailure(['echo tr("a", "a", 1)'], 'E1013: Argument 3: type mismatch, expected string but got number')
enddef

def Test_typename()
if has('float')
assert_equal('func([unknown], [unknown]): float', typename(function('pow')))
endif
enddef

def Test_undofile()
CheckDefFailure(['undofile(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
assert_equal('.abc.un~', fnamemodify(undofile('abc'), ':t'))
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3134,
/**/
3133,
/**/
Expand Down
2 changes: 1 addition & 1 deletion src/vim9type.c
Expand Up @@ -1166,7 +1166,7 @@ type_name(type_T *type, char **tofree)

for (i = 0; i < type->tt_argcount; ++i)
{
char *arg_free;
char *arg_free = NULL;
char *arg_type;
int len;

Expand Down

0 comments on commit 9da32e4

Please sign in to comment.