[luatex] segfault with luatex id 7509

luigi scarso luigi.scarso at gmail.com
Sat Nov 5 16:35:11 CET 2022


On Sat, 5 Nov 2022 at 16:29, Michal Vlasák <lahcim8 at gmail.com> wrote:

> On Thu Sep 29, 2022 at 11:58 PM CEST, Werner LEMBERG wrote:
> >
> > Please unpack the attached tarball and call `./zzz.sh`.  On my
> > openSUSE box using a current SVN version of TeXLive, this crashes with
> > a segfault.
>
> I think I found the issue and have a fix (attached). (Hans CC'd: I
> believe this also applies to LuaMetaTeX.)
>
> The segfaults are in the calls to Lua C API from the function
> `load_hyphenation`, which gets called as a result of `\hyphenation`. The
> issue is that before pushing to the Lua stack one has to make sure there
> is enough free space there (by calling `lua_checkstack`) -- in this case
> `load_hyphenation` pushes at most 3 values to the stack. Reserving the
> space on the stack should fix the issue.
>
> But I am fairly sure that the stack would (usually) have at least the 3
> needed free slots -- after all LuaTeX doesn't reserve stack space too
> often, and other things work just fine. This unveiled another problem:
> `load_hyphenation` never pops the table it appends to, so many calls to
> it slowly exhaust the stack. A call to `lua_pop` is needed at the end.
>
> Patch that adds `lua_checkstack` and `lua_pop` is attached.
>
> Note that the issue exhibits itself so severely because the file
> `hyphenation.texi` does `\hyphenation` for each word separately, this is
> less efficient and unnecessary, when `\hyphenation` can process many
> words just fine.
>
>
> Michal
>
>
> PS: I performed the analysis on a slightly older version of LuaTeX and
> in a different build environment, though I think the analysis and
> conclusions still apply.
>

Thank you very much, I will check your patch this evening very carefully.
I know that there was an issue with the lua stack but I  was not able to
catch it
due to the lack of the time and the migrations of the svn repos.
Anyway, if it's ok I will commit it to the texlive svn repo.


--
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20221105/e70d124a/attachment.html>


More information about the luatex mailing list.