lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


  I've been spending the past few days updating from Lua 5.3.6 (with all the
patches) to Lua 5.4.2.  So far, I've encounted one issue where Lua 5.4.2
will segfault where Lua 5.3.6 does not (I have not tested Lua 5.4.0 or
5.4.1).  I have tried with Lua 5.4.2 with LUA_USE_APICHECK, and it still
segfaults without any diagnostics.

  I've isolated the problem:

(gdb) where
#0  0x0806a7bc in resizebox (L=0x8d9900c, idx=-1, newsize=2048) at lauxlib.c:477
#1  0x0806a96e in prepbuffsize (B=0xbfa1d448, sz=1, boxidx=-1) at lauxlib.c:546
#2  0x0806aa41 in luaL_addlstring (B=0xbfa1d448, s=0x8dbd1b0 "\n", l=1) at lauxlib.c:572
#3  0xb7de62ca in yy_5_CHAR (yy=0xbfa1d400, yytext=0x8dbd1b0 "\n", yyleng=1) at html.i:3
#4  0xb7de600c in yyDone (yy=0xbfa1d400) at html.i:226
#5  0xb7e1b7c8 in yyparsefrom (yyctx=0xbfa1d400, yystart=0xb7e1b5e0 <yy_BODY>) at html.i:11517
#6  0xb7e1b809 in yyparse (yyctx=0xbfa1d400) at html.i:11524
#7  0xb7e1bd11 in parse (L=0x8d9900c) at html.c:161
	[ rest of stack trace snipped ]
(gdb) p box
$1 = (UBox *) 0x0
(gdb) 

  Now, some context.  I originally wrote an HTML parser in LPEG, but found
that it consumed way too much memory for my liking.  I then found a PEG
library for C, which I used to generate a replacement module that uses way
less memory (and is faster, but that's just a nice benefit).  The module
works find under Lua 5.3.6.  I've also included both the PEG file and the
output from the PEG library so no one has to install it [1].

  I'm including a tarball of everything needed to reproduce the issue as I'm
not wise in the internals of Lua.  I checked section 8 of the Lua manual,
and I didn't see anything that applied.

  Thanks for any help.

  -spc

[1]	https://www.piumarta.com/software/peg/