[luatex] Using 'append_to_vlist_filter' callback causes stack overflow on Lua side

Hironori KITAGAWA h_kitagawa2001 at yahoo.co.jp
Thu Aug 4 23:34:56 CEST 2022

Hello all,

I'm looking into 

Iit seems that using the 'append_to_vlist_filter' callback with a large
number of paragraphs causes a stack overflow.

---- source file (t45298-2.tex)
% plain LuaTeX or LuaLaTeX
\expandafter\else\input luatexbase.sty
    function (b, loc, prev, mirrored) node.write(b); return nil end,
  'test', 1)}

  \advance\foo1 \ifnum\foo<500000 \expandafter\A\fi}

---- plain LuaTeX
This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev) 
 restricted system commands enabled.
(/opt/texlive/2022/texmf-dist/tex/latex/base/ltluatex.tex))) [1{/opt/texlive/20
22/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2]
... [2192]
warning  (append to vlist): error: [\directlua]:1: stack overflow
\A ->a\space \par 
                  \advance \foo 1 \ifnum \foo <500000 \expandafter \A
\fi l.13 \A
Processing t45298-2.tex with lualatex also causes the overflow:
---- LuaLaTeX
... [2583]
warning  (node filter): error: ...xmf-dist/tex/luatex/luaotfload/fontloader-202
2-06-15.lua:25611: stack overflow

<argument> ...ype:D \tex_hskip:D \c_zero_dim \fi: \tex_par:D 
                                                  \hook_use:n {para/after}\@...

l.13 \A

I found that there isn't "lua_settop(Luas, s_top);" before "return 1;" 
statement of the function lua_appendtovlist_callback() (lua/luanodes.c).
Is this related to the overflow?

<h_kitagawa2001 at yahoo.co.jp>

More information about the luatex mailing list.