[latex3-commits] [git/LaTeX3-latex3-latex2e] gh1041: adjust extrafloats for issue #1041 (f800c8f2)

David Carlisle d.p.carlisle at gmail.com
Sat Apr 15 13:31:56 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : gh1041
Link       : https://github.com/latex3/latex2e/commit/f800c8f2d3f19ffcc7ede4c5d46859208c0ca808

>---------------------------------------------------------------

commit f800c8f2d3f19ffcc7ede4c5d46859208c0ca808
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sat Apr 15 12:31:56 2023 +0100

    adjust extrafloats for issue #1041


>---------------------------------------------------------------

f800c8f2d3f19ffcc7ede4c5d46859208c0ca808
 base/changes.txt                                   |  5 ++++
 base/ltplain.dtx                                   | 14 +++++++---
 base/testfiles/github-1041.lvt                     | 30 ++++++++++++++++++++++
 base/testfiles/github-1041.tlg                     | 10 ++++++++
 base/testfiles/github-1041b.lvt                    |  9 +++++++
 .../{github-0060.luatex.tlg => github-1041b.tlg}   |  0
 6 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index f7af41e9..655ea6a3 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2023-04-15  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltplain.dtx: adjust \extrafloats so it does not error if thousands
+	of float boxes are allocated. github/1041
+
 2023-04-13  David Carlisle  <David.Carlisle at latex-project.org>
 
 	* cmfonts.fdd: add missing substitution for U/cmtt/bx/sl gh/1037
diff --git a/base/ltplain.dtx b/base/ltplain.dtx
index f76aa34e..89e50173 100644
--- a/base/ltplain.dtx
+++ b/base/ltplain.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltplain.dtx}
-             [2023/04/01 v2.3h LaTeX Kernel (Plain TeX)]
+             [2023/04/15 v2.3i LaTeX Kernel (Plain TeX)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltplain.dtx}
@@ -660,6 +660,10 @@
 \def\extrafloats#1{%
 \ifnum#1>\z@
 \count@\numexpr\float at count-1\relax
+%    \end{macrocode}
+% \changes{v2.3i}{2023/04/15}{Protect box 255 in lualatex gh/1041}
+%    \begin{macrocode}
+  \ifnum\count@<266 \ch at ck0\m at ne\insert\fi
   \ch at ck0\count@\count
   \ch at ck1\count@\dimen
   \ch at ck2\count@\skip
@@ -668,8 +672,12 @@
 \global\expandafter\e at alloc@chardef
             \csname bx@\the\float at count\endcsname\float at count
 \@cons\@freelist{\csname bx@\the\float at count\endcsname}%
-\expandafter
-\extrafloats\expandafter{\numexpr#1-1\relax}%
+%    \end{macrocode}
+% \changes{v2.3i}{2023/04/15}{unwind numexpr and ifnum nesting}
+%    \begin{macrocode}
+\expandafter\extrafloats\expandafter{\the\numexpr#1-1\expandafter}%
+%    \end{macrocode}
+%    \begin{macrocode}
 \fi}%
 %    \end{macrocode}
 %
diff --git a/base/testfiles/github-1041.lvt b/base/testfiles/github-1041.lvt
new file mode 100644
index 00000000..9e5fc3da
--- /dev/null
+++ b/base/testfiles/github-1041.lvt
@@ -0,0 +1,30 @@
+\documentclass{article}
+\input{test2e}
+
+\START
+% This should stop with a no room error
+% before reaching box255 or previous allocations
+
+% silence \wlog lines from \newinsert
+\def\wlog#1{}
+
+%stop after error
+\let\xerrmessage\errmessage
+\def\errmessage#1{\xerrmessage{#1}\END}
+
+\loop
+\newinsert\tmp
+\ifnum\tmp=255
+\errmessage{BOX 255: \meaning\tmp}
+\END
+\fi
+\ifcsname X\number\tmp\endcsname
+\errmessage{DUPLICATE ALLOCATION: \meaning\tmp}
+\END
+\else
+\expandafter\def\csname X\number\tmp\endcsname{}
+\fi
+\iftrue
+\repeat
+
+
diff --git a/base/testfiles/github-1041.tlg b/base/testfiles/github-1041.tlg
new file mode 100644
index 00000000..bec444f4
--- /dev/null
+++ b/base/testfiles/github-1041.tlg
@@ -0,0 +1,10 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+! No room for a new \insert .
+\errmessage #1->\xerrmessage {#1}
+                                 \END 
+l. ...\repeat
+This error message was generated by an \errmessage
+command, so I can't give any explicit help.
+Pretend that you're Hercule Poirot: Examine all clues,
+and deduce the truth by order and method.
diff --git a/base/testfiles/github-1041b.lvt b/base/testfiles/github-1041b.lvt
new file mode 100644
index 00000000..8cb6283a
--- /dev/null
+++ b/base/testfiles/github-1041b.lvt
@@ -0,0 +1,9 @@
+\documentclass{article}
+\input{test2e}
+
+\START
+% This should not error from numexpr depth or main memory
+
+\extrafloats{2000}
+
+\END
\ No newline at end of file
diff --git a/base/testfiles/github-0060.luatex.tlg b/base/testfiles/github-1041b.tlg
similarity index 100%
copy from base/testfiles/github-0060.luatex.tlg
copy to base/testfiles/github-1041b.tlg





More information about the latex3-commits mailing list.