]> granicus.if.org Git - vim/commitdiff
patch 8.2.3134: crash when using typename() on a function reference v8.2.3134
authorBram Moolenaar <Bram@vim.org>
Fri, 9 Jul 2021 17:53:57 +0000 (19:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 9 Jul 2021 17:53:57 +0000 (19:53 +0200)
Problem:    Crash when using typename() on a function reference. (Naohiro Ono)
Solution:   Initialize pointer to NULL. (closes #8531)

src/testdir/test_vim9_builtin.vim
src/version.c
src/vim9type.c

index dcf60072f10cb4cf461d5aa2381e7a8ffdad59e2..5964ded70ca2cdc2dd322ffb842102d952484f0b 100644 (file)
@@ -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'))
index 39d8f1455c28871ebfde9059e3c54053ac0d17c3..10a5f716864bb431ee1195447a3ddfa065bd9bbb 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3134,
 /**/
     3133,
 /**/
index 5cf1f428444beeb87a484d64d831e2ff8ccf97be..c4f3cd504c3f3726152c7a9d51216181118d9ae2 100644 (file)
@@ -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;