summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/ChangeLog5
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web1
-rw-r--r--Build/source/texk/web2c/tests/expanded-overflow.tex43
-rw-r--r--Build/source/texk/web2c/xetexdir/ChangeLog5
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.web1
6 files changed, 61 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 1bbc932bf51..813f1d0d6fe 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-31 Karl Berry <karl@freefriends.org>
+
+ * tests/expanded-overflow.tex: new (unused) informational file
+ for \expanded overflow.
+
2020-08-01 Andreas Scherer <https://ascherer.github.io>
* dvicopy.ch,
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index 3407a8e995a..8cf207788af 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-31 Marcel Fabian Krueger <tex@2krueger.de>
+
+ * pdftex.web (Scan the argument for command |c|) <expanded_code>:
+ free_avail(def_ref) to avoid memory exhaustion with many \expanded.
+
2020-08-04 Andreas Scherer <https://ascherer.github.io>
* pdftex.web: Pick a few obvious nits.
@@ -7,6 +12,7 @@
* pdftex.ch: Move pdfTeX variants of MLTeX code next to originals.
2020-07-22 Akira Kakuto <kakuto@w32tex.org>
+
* pdftex.web, writeimg.c: Show unfound file names in
fatal error messages.
https://tug.org/pipermail/pdftex/2020-July/009203.html
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index 7cfd17ed1a6..721aa694ba2 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -10955,6 +10955,7 @@ expanded_code:
warning_index := save_warning_index;
scanner_status := save_scanner_status;
ins_list(link(def_ref));
+ free_avail(def_ref);
def_ref := save_def_ref;
restore_cur_string;
return;
diff --git a/Build/source/texk/web2c/tests/expanded-overflow.tex b/Build/source/texk/web2c/tests/expanded-overflow.tex
new file mode 100644
index 00000000000..473a634cdf8
--- /dev/null
+++ b/Build/source/texk/web2c/tests/expanded-overflow.tex
@@ -0,0 +1,43 @@
+% $Id$
+% Public domain.
+\catcode`\{=1 \catcode`\}=2 \catcode`\#=6
+\def\zz#1{#1#1#1#1#1#1#1#1#1#1}% 10 times
+\def\zzz#1{\zz{\zz{\zz{\zz{\zz{\zz{\zz{#1}}}}}}}}% 10 million times
+\def\empty{}
+\zzz{\expanded{\empty}}
+\end
+
+% Date: Mon, 31 Aug 2020 01:01:17 +0200
+% From: Marcel Fabian Krueger <tex@2krueger.de>
+% Subject: Re: [PATCH] \expanded main memory bug
+%
+% [...]
+% You might have heard that Jonathan Spratte got a bug in pdfTeX and
+% XeTeX: Using \expanded more than 5*10^6 times triggered a main memory
+% exhaustion. [that is:
+% ! TeX capacity exceeded, sorry [main memory size=8000000].
+% ]
+%
+% This was caused by \expanded only passing link(def_ref) to the input
+% stack, leaking the reference counter pointed to by def_ref. A patch for
+% both engines is attached.
+%
+% --- pdftexdir/pdftex.web
+% +++ pdftexdir/pdftex.web
+% @@ -10955,6 +10955,7 @@ expanded_code:
+% ins_list(link(def_ref));
+% + free_avail(def_ref);
+% def_ref := save_def_ref;
+%
+% --- xetexdir/xetex.web
+% +++ xetexdir/xetex.web
+% @@ -11094,6 +11094,7 @@ expanded_code:
+% ins_list(link(def_ref));
+% + free_avail(def_ref);
+% def_ref := save_def_ref;
+
+
+
+% [Applied in r56230. Then the test document from Marcel above runs to
+% completion. We don't actually try to use this during make check or
+% anything else, just recording the information. --karl]
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog
index 7161f3fc26f..891856ab670 100644
--- a/Build/source/texk/web2c/xetexdir/ChangeLog
+++ b/Build/source/texk/web2c/xetexdir/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-31 Marcel Fabian Krueger <tex@2krueger.de>
+
+ * xetex.web (Scan the argument for command |c|) <expanded_code>:
+ free_avail(def_ref) to avoid memory exhaustion with many \expanded.
+
2020-08-19 Andreas Scherer <https://ascherer.github.io>
* xetex.web: Fix math operator in Pascal comment.
diff --git a/Build/source/texk/web2c/xetexdir/xetex.web b/Build/source/texk/web2c/xetexdir/xetex.web
index 5eec78ca7a2..bf826dc52a2 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.web
+++ b/Build/source/texk/web2c/xetexdir/xetex.web
@@ -11094,6 +11094,7 @@ expanded_code:
warning_index := save_warning_index;
scanner_status := save_scanner_status;
ins_list(link(def_ref));
+ free_avail(def_ref);
def_ref := save_def_ref;
restore_cur_string;
return;