summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mplibdir/mp.w
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/mplibdir/mp.w')
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w8
1 files changed, 6 insertions, 2 deletions
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index 2a28640c215..acb64feed7f 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -18136,11 +18136,15 @@ 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;
- if ( mp->input_ptr==mp->stack_size ) {
+ /* 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);
+ }
}
mp->input_stack[mp->input_ptr]=mp->cur_input; /* stack the record */
incr(mp->input_ptr);