From 7be476b9aaffe6f6e987cfa0a492e857ed6418aa Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Mon, 10 May 2021 13:02:08 +0000 Subject: MetaPost: fixed the patch on the stack overflow. git-svn-id: svn://tug.org/texlive/trunk@59158 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/luatex_svnversion.h | 2 +- Build/source/texk/web2c/mplibdir/mp.w | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h index 883b2d562f3..b40380e1055 100644 --- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h +++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h @@ -1 +1 @@ -#define luatex_svn_revision 7438 +#define luatex_svn_revision 7439 diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index acb64feed7f..469218c692b 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -18136,15 +18136,13 @@ new level (having, initially, the same properties as the old). @d push_input { /* enter a new input level, save the old */ if ( mp->input_ptr>mp->max_in_stack ) { mp->max_in_stack=mp->input_ptr; - /* The mp->stack_size < 1001 condition is necessary to prevent stack overflow due infinite recursion. */ - if ( mp->input_ptr==mp->stack_size && mp->stack_size < 1001) { - int l = (mp->stack_size+(mp->stack_size/4)); - XREALLOC(mp->input_stack, l, in_state_record); - mp->stack_size = l; - } else { - fprintf(stderr, "input stack overflow\n"); - exit(EXIT_FAILURE); - } + if ( mp->input_ptr==mp->stack_size ) { + int l = (mp->stack_size+(mp->stack_size/4)); + /* The mp->stack_size < 1001 condition is necessary to prevent C stack overflow due infinite recursion. */ + if (l>1000) {fprintf(stderr, "input stack overflow\n");exit(EXIT_FAILURE);} + XREALLOC(mp->input_stack, l, in_state_record); + mp->stack_size = l; + } } mp->input_stack[mp->input_ptr]=mp->cur_input; /* stack the record */ incr(mp->input_ptr); -- cgit v1.2.3