Dear devs,
The example below crashes LuaTeX with a segmentation fault. It is reproducible
with LuaTeX 1.10.1 7143 and LuaTeX 1.11.2 7226. To this end I built 7226 from
source with --debugopt to get a backtrace, which can be found below as well.
Cheers, Henri
---
\directlua{token.set_macro(-1, "foo","\string\\,")}
\show\foo
\foo
\bye
---
(gdb) run
Starting program: /usr/local/bin/luatex test.tex
This is LuaTeX, Version 1.11.2 (TeX Live 2020/dev)
restricted system commands enabled.
(./test.tex
Program received signal SIGSEGV, Segmentation fault.
get_sa_item (head=0x41002, n=n@entry=92) at ../../../source/texk/web2c/luatexdir/utils/managed-sa.c:65
65 if (head->tree != NULL) {
(gdb) bt full
#0 get_sa_item (head=0x41002, n=n@entry=92) at ../../../source/texk/web2c/luatexdir/utils/managed-sa.c:65
No locals.
#1 0x00000000005607d0 in get_cat_code (h=h@entry=-1, n=n@entry=92) at ../../../source/texk/web2c/luatexdir/tex/textcodes.c:68
sa_value = <optimized out>
s = <optimized out>
#2 0x00000000004d8a8c in set_macro (L=<optimized out>) at ../../../source/texk/web2c/luatexdir/lua/lnewtokenlib.c:1204
p = <optimized out>
q = <optimized out>
t = <optimized out>
se = 0x295bf9a ""
name = <optimized out>
str = <optimized out>
s = <optimized out>
lname = 3
lstr = 2
cs = 743
cc = <optimized out>
ct = -1
n = <optimized out>
a = 0
nncs = <optimized out>
#3 0x00000000006dc924 in luaD_precall (L=L@entry=0x1202678, func=func@entry=0x2214490, nresults=nresults@entry=0)
at ../../../source/libs/lua53/lua53-src/src/ldo.c:434
n = <optimized out>
f = 0x4d8890
ci = 0x123c830
#4 0x00000000006f62c2 in luaV_execute (L=L@entry=0x1202678) at ../../../source/libs/lua53/lua53-src/src/lvm.c:1134
b = <optimized out>
nresults = 0
i = <optimized out>
ra = 0x2214490
ci = 0x12221c0
cl = 0x2952f00
k = 0x294ea40
base = <optimized out>
#5 0x00000000006dcef7 in luaD_call (nResults=<optimized out>, func=<optimized out>, L=0x1202678) at ../../../source/libs/lua53/lua53-src/src/ldo.c:499
No locals.
#6 luaD_callnoyield (L=0x1202678, func=<optimized out>, nResults=<optimized out>) at ../../../source/libs/lua53/lua53-src/src/ldo.c:509
No locals.
#7 0x00000000006db78c in luaD_rawrunprotected (L=0x1202678, f=0x6d0800 , ud=0x7fffffffdf80) at ../../../source/libs/lua53/lua53-src/src/ldo.c:142
oldnCcalls = 0
lj = {previous = 0x0, b = {{__jmpbuf = {832, -3576387603206626035, 18884312, 1, 18884216, 0, 3576387604335174925, -3576387282536356595},
__mask_was_saved = 0, __saved_mask = {__val = {0, 18884312, 18884216, 7198250, 35733824, 72057594037927937, 140737488346976, 0, 0, 0, 0, 0, 0,
0, 0, 0}}}}, status = 0}
#8 0x00000000006dd3af in luaD_pcall (L=L@entry=0x1202678, func=func@entry=0x6d0800 , u=u@entry=0x7fffffffdf80, old_top=832, ef=<optimized out>)
at ../../../source/libs/lua53/lua53-src/src/ldo.c:729
status = <optimized out>
old_ci = 0x12026d8
old_allowhooks = 1 '\001'
old_nny = 1
old_errfunc = 0
oldtop = <optimized out>
#9 0x00000000006d3907 in lua_pcallk (L=0x1202678, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=51, ctx=ctx@entry=0, k=k@entry=0x0)
at ../../../source/libs/lua53/lua53-src/src/lapi.c:969
c = {func = 0x2214480, nresults = 0}
status = <optimized out>
func = <optimized out>
#10 0x0000000000463b5f in luatokencall (p=p@entry=9030, nameptr=nameptr@entry=0) at ../../../source/texk/web2c/luatexdir/lua/luastuff.c:653
base = 51
ls = {s = 0x295e890 "\240܂\367\377\177", size = 0}
i = 0
l = 32
s = 0x0
lua_id = <optimized out>
stacktop = 50
#11 0x0000000000567a83 in conv_toks () at ../../../source/texk/web2c/luatexdir/tex/textoken.c:2859
old_setting = <optimized out>
p = <optimized out>
q = <optimized out>
save_scanner_status = 0
save_def_ref = 0
save_warning_index = 0
bool = <optimized out>
s = 9030
sn = 0
u = 0
c = <optimized out>
str = <optimized out>
i = 0
#12 0x0000000000503a25 in expand () at ../../../source/texk/web2c/luatexdir/tex/expand.c:259
t = <optimized out>
p = <optimized out>
---Type <return> to continue, or q <return> to quit---
cur_ptr = <optimized out>
cv_backup = 0
cvl_backup = 0
radix_backup = 0
co_backup = 0
backup_backup = 7961
save_scanner_status = <optimized out>
#13 0x0000000000503f85 in get_x_token () at ../../../source/texk/web2c/luatexdir/tex/expand.c:501
No locals.
#14 0x0000000000513ae5 in main_control () at ../../../source/texk/web2c/luatexdir/tex/maincontrol.c:1014
No locals.
#15 0x000000000050f4ac in main_body () at ../../../source/texk/web2c/luatexdir/tex/mainbody.c:567
pdftex_map = "pdftex.map"
bad = <optimized out>
#16 0x0000000000446d2e in main (ac=<optimized out>, av=<optimized out>) at ../../../source/texk/web2c/luatexdir/luatex.c:609
No locals.