1
0
forked from aniani/vim

patch 8.2.2810: Vim9: crash when calling a function in a substitute expression

Problem:    Vim9: crash when calling a function in a substitute expression.
Solution:   Set the instructions back to the substitute expression
            instrunctions. (closes #8148)
This commit is contained in:
Bram Moolenaar
2021-04-25 14:48:49 +02:00
parent dc4c2309f2
commit d386e923c7
3 changed files with 30 additions and 1 deletions

View File

@@ -601,6 +601,12 @@ func_return(ectx_T *ectx)
+ STACK_FRAME_IDX_OFF)->vval.v_number;
ectx->ec_instr = INSTRUCTIONS(prev_dfunc);
// If the call was inside an ISN_SUBSTITUTE instruction need to use its
// list of instructions.
if (ectx->ec_instr[ectx->ec_iidx - 1].isn_type == ISN_SUBSTITUTE)
ectx->ec_instr = ectx->ec_instr[ectx->ec_iidx - 1]
.isn_arg.subs.subs_instr;
if (floc == NULL)
ectx->ec_funclocal.floc_restore_cmdmod = FALSE;
else