Patch 8.2.2357

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 15, 2021, 1:05:10 PM1/15/21
to vim...@googlegroups.com

Patch 8.2.2357
Problem: Vim9: crash when parsing function return type fails.
Solution: Bail out and set return type to "unknown". (closes #7685)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2356/src/userfunc.c 2021-01-08 22:24:16.467725889 +0100
--- src/userfunc.c 2021-01-15 18:55:17.947225612 +0100
***************
*** 3886,3891 ****
--- 3886,3897 ----
{
p = ret_type;
fp->uf_ret_type = parse_type(&p, &fp->uf_type_list, TRUE);
+ if (fp->uf_ret_type == NULL)
+ {
+ fp->uf_ret_type = &t_void;
+ SOURCING_LNUM = lnum_save;
+ goto erret;
+ }
}
SOURCING_LNUM = lnum_save;
}
*** ../vim-8.2.2356/src/testdir/test_vim9_func.vim 2021-01-10 22:42:46.920847063 +0100
--- src/testdir/test_vim9_func.vim 2021-01-15 18:59:38.658602165 +0100
***************
*** 197,202 ****
--- 197,213 ----
s:nothing->assert_equal(1)
enddef

+ def Test_return_invalid()
+ var lines =<< trim END
+ vim9script
+ def Func(): invalid
+ return xxx
+ enddef
+ defcompile
+ END
+ CheckScriptFailure(lines, 'E1010:', 2)
+ enddef
+
func Increment()
let g:counter += 1
endfunc
*** ../vim-8.2.2356/src/version.c 2021-01-15 18:04:40.102419940 +0100
--- src/version.c 2021-01-15 19:04:14.233946909 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2357,
/**/

--
hundred-and-one symptoms of being an internet addict:
156. You forget your friend's name but not her e-mail address.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages