Patch 8.2.2600
Problem: Vim9: crash when putting an unknown type in a dictionary.
(Yegappan Lakshmanan)
Solution: Handle a NULL type pointer.
Files: src/vim9type.c, src/testdir/test_vim9_builtin.vim
*** ../vim-8.2.2599/src/vim9type.c 2021-02-11 21:19:30.518147953 +0100
--- src/vim9type.c 2021-03-13 21:21:11.180848658 +0100
***************
*** 919,924 ****
--- 919,926 ----
{
int i;
+ if (type1 == NULL || type2 == NULL)
+ return FALSE;
if (type1->tt_type != type2->tt_type)
return FALSE;
switch (type1->tt_type)
***************
*** 969,980 ****
// If either is VAR_UNKNOWN use the other type. An empty list/dict has no
// specific type.
! if (type1->tt_type == VAR_UNKNOWN)
{
*dest = type2;
return;
}
! if (type2->tt_type == VAR_UNKNOWN)
{
*dest = type1;
return;
--- 971,982 ----
// If either is VAR_UNKNOWN use the other type. An empty list/dict has no
// specific type.
! if (type1 == NULL || type1->tt_type == VAR_UNKNOWN)
{
*dest = type2;
return;
}
! if (type2 == NULL || type2->tt_type == VAR_UNKNOWN)
{
*dest = type1;
return;
*** ../vim-8.2.2599/src/testdir/test_vim9_builtin.vim 2021-03-10
16:08:22.737770798 +0100
--- src/testdir/test_vim9_builtin.vim 2021-03-13 21:24:03.156508186 +0100
***************
*** 340,345 ****
--- 340,365 ----
CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1)
enddef
+ def Test_extend_with_error_function()
+ var lines =<< trim END
+ vim9script
+ def F()
+ {
+ var m = 10
+ }
+ echo m
+ enddef
+
+ def Test()
+ var d: dict<any> = {}
+ d->extend({A: 10, Func: function('F', [])})
+ enddef
+
+ Test()
+ END
+ CheckScriptFailure(lines, 'E1001: Variable not found: m')
+ enddef
+
def Test_job_info_return_type()
if has('job')
job_start(&shell)
*** ../vim-8.2.2599/src/version.c 2021-03-13 21:14:15.165663825 +0100
--- src/version.c 2021-03-13 21:21:52.896766205 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2600,
/**/
--
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202103132026.12DKQFV4067177%40masaka.moolenaar.net.