Patch 8.2.4309
Problem: Vim9: crash when using a partial in the wrong context.
Solution: Don't use an NULL outer pointer. (closes #9706)
Files: src/vim9execute.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.4308/src/vim9execute.c 2022-02-02 20:01:21.957210955 +0000
--- src/vim9execute.c 2022-02-06 13:53:40.024542493 +0000
***************
*** 1694,1700 ****
}
/*
! * Store a value in a list or dict variable.
* Returns OK, FAIL or NOTDONE (uncatchable error).
*/
static int
--- 1694,1700 ----
}
/*
! * Store a value in a list, dict or blob variable.
* Returns OK, FAIL or NOTDONE (uncatchable error).
*/
static int
***************
*** 5081,5092 ****
goto failed_early;
if (partial != NULL)
{
! if (partial->pt_outer.out_stack == NULL && current_ectx != NULL)
{
! if (current_ectx->ec_outer_ref != NULL
! && current_ectx->ec_outer_ref->or_outer != NULL)
! ectx.ec_outer_ref->or_outer =
current_ectx->ec_outer_ref->or_outer;
}
else
{
--- 5081,5096 ----
goto failed_early;
if (partial != NULL)
{
! if (partial->pt_outer.out_stack == NULL)
{
! if (current_ectx != NULL)
! {
! if (current_ectx->ec_outer_ref != NULL
! && current_ectx->ec_outer_ref->or_outer != NULL)
! ectx.ec_outer_ref->or_outer =
current_ectx->ec_outer_ref->or_outer;
+ }
+ // Should there be an error here?
}
else
{
*** ../vim-8.2.4308/src/testdir/test_vim9_func.vim 2022-02-03
12:34:00.665140482 +0000
--- src/testdir/test_vim9_func.vim 2022-02-06 13:52:46.400614018 +0000
***************
*** 3125,3130 ****
--- 3125,3159 ----
v9.CheckScriptFailure(lines, 'E1235:')
enddef
+ " Using "idx" from a legacy global function does not work.
+ " This caused a crash when called from legacy context.
+ func Test_partial_call_fails()
+ let lines =<< trim END
+ vim9script
+
+ var l = ['a', 'b', 'c']
+ def Iter(container: any): any
+ var idx = -1
+ var obj = {state: container}
+ def g:__NextItem__(self: dict<any>): any
+ ++idx
+ return self.state[idx]
+ enddef
+ obj.__next__ = function('g:__NextItem__', [obj])
+ return obj
+ enddef
+
+ var it = Iter(l)
+ echo it.__next__()
+ END
+ call writefile(lines, 'XpartialCall')
+ try
+ source XpartialCall
+ catch /E1248:/
+ endtry
+ call delete('XpartialCall')
+ endfunc
+
def Test_cmd_modifier()
tab echo '0'
v9.CheckDefFailure(['5tab echo 3'], 'E16:')
*** ../vim-8.2.4308/src/version.c 2022-02-06 13:08:37.471920907 +0000
--- src/version.c 2022-02-06 13:37:00.394090673 +0000
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4309,
/**/
--
hundred-and-one symptoms of being an internet addict:
11. You find yourself typing "com" after every period when using a word
processor.com
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20220206135602.C63021C071D%40moolenaar.net.