summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/tests
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-08-31 22:30:33 +0000
committerKarl Berry <karl@freefriends.org>2020-08-31 22:30:33 +0000
commiteb17b1dd68429ed12b3119e12ca636db57c8c262 (patch)
tree0ecf061a877308a57583be5534ba9ce09b9bf153 /Build/source/texk/web2c/tests
parentf2c3a00c5a4c8a9357422c0dcc50eaeae0e67893 (diff)
fix \expanded memory leak of def_ref
git-svn-id: svn://tug.org/texlive/trunk@56230 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/tests')
-rw-r--r--Build/source/texk/web2c/tests/expanded-overflow.tex43
1 files changed, 43 insertions, 0 deletions
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]