0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.0098: exe stack length can be wrong without being detected

Problem:    Exe stack length can be wrong without being detected.
Solution:   Add a check when ABORT_ON_INTERNAL_ERROR is defined.
This commit is contained in:
Bram Moolenaar
2020-01-07 20:59:34 +01:00
parent ce6db0273f
commit e31ee86859
10 changed files with 46 additions and 0 deletions

View File

@@ -3086,16 +3086,19 @@ exe_pre_commands(mparm_T *parmp)
char_u **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands;
int i;
ESTACK_CHECK_DECLARATION
if (cnt > 0)
{
curwin->w_cursor.lnum = 0; // just in case..
estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0);
ESTACK_CHECK_SETUP
# ifdef FEAT_EVAL
current_sctx.sc_sid = SID_CMDARG;
# endif
for (i = 0; i < cnt; ++i)
do_cmdline_cmd(cmds[i]);
ESTACK_CHECK_NOW
estack_pop();
# ifdef FEAT_EVAL
current_sctx.sc_sid = 0;
@@ -3111,6 +3114,7 @@ exe_pre_commands(mparm_T *parmp)
exe_commands(mparm_T *parmp)
{
int i;
ESTACK_CHECK_DECLARATION
/*
* We start commands on line 0, make "vim +/pat file" match a
@@ -3121,6 +3125,7 @@ exe_commands(mparm_T *parmp)
if (parmp->tagname == NULL && curwin->w_cursor.lnum <= 1)
curwin->w_cursor.lnum = 0;
estack_push(ETYPE_ARGS, (char_u *)"command line", 0);
ESTACK_CHECK_SETUP
#ifdef FEAT_EVAL
current_sctx.sc_sid = SID_CARG;
current_sctx.sc_seq = 0;
@@ -3131,6 +3136,7 @@ exe_commands(mparm_T *parmp)
if (parmp->cmds_tofree[i])
vim_free(parmp->commands[i]);
}
ESTACK_CHECK_NOW
estack_pop();
#ifdef FEAT_EVAL
current_sctx.sc_sid = 0;
@@ -3340,12 +3346,14 @@ process_env(
#ifdef FEAT_EVAL
sctx_T save_current_sctx;
#endif
ESTACK_CHECK_DECLARATION
if ((initstr = mch_getenv(env)) != NULL && *initstr != NUL)
{
if (is_viminit)
vimrc_found(NULL, NULL);
estack_push(ETYPE_ENV, env, 0);
ESTACK_CHECK_SETUP
#ifdef FEAT_EVAL
save_current_sctx = current_sctx;
current_sctx.sc_sid = SID_ENV;
@@ -3355,6 +3363,7 @@ process_env(
#endif
do_cmdline_cmd(initstr);
ESTACK_CHECK_NOW
estack_pop();
#ifdef FEAT_EVAL
current_sctx = save_current_sctx;