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.
diff --git a/src/main.c b/src/main.c
index 51b8970..117c207 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3086,16 +3086,19 @@
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_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 @@
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 @@
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 @@
#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 @@
#endif
do_cmdline_cmd(initstr);
+ ESTACK_CHECK_NOW
estack_pop();
#ifdef FEAT_EVAL
current_sctx = save_current_sctx;