Question about a crash

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about a crash

Chris Jones
Hey folks

I've had a crash report with a backtrace like this:

Crashed: com.apple.main-thread
EXC_BAD_ACCESS 0x0000000000000000
0  LuaSkin                        0x10bf31a58 luaD_precall (ldo.c:453)
1  LuaSkin                        0x10bf2e3f5 luaV_execute (lvm.c:1134)
2  LuaSkin                        0x10bf31bd2 luaD_call (ldo.c:517)
3  LuaSkin                        0x10bf31c13 luaD_callnoyield (ldo.c:527)
4  LuaSkin                        0x10bf3994e luai_objcttry (lobjectivec_exceptions.m:173)
5  LuaSkin                        0x10bf3219b luaD_pcall (ldo.c:162)
6  LuaSkin                        0x10bf43301 lua_pcallk (lapi.c:968)
7  LuaSkin                        0x10bf26209 -[LuaSkin protectedCallAndTraceback:nresults:] (Skin.m:244)

(LuaSkin is our Lua 5.3.4 wrapper, and protectedCallAndTraceback is the method that calls lua_pcall())

Looking at ldo.c, I'm not convinced that line 453 is at fault, I rather more suspect that line 451 is where the NULL pointer dereference is happening, in that I suspect f is NULL.

My question then, is how could f be NULL? Has anyone else run into something like this? I can force a similar crash to happen if I define a luaL_Reg function to point to NULL, but I believe I've checked all of the places where we declare functions and none of them are NULL.

--
Cheers,

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Question about a crash

Luiz Henrique de Figueiredo
If you can, rebuilt Lua with LUA_USE_APICHECK on. It may help locate
the problem.

Reply | Threaded
Open this post in threaded view
|

Re: Question about a crash

Chris Jones
Hey

I already have LUA_USE_APICHECK defined in the current release builds from tracking down some other crash bugs in the last couple of weeks. This luaD_precall crash seems to be the last one.

I'm considering patching Lua temporarily to check if f is NULL, and if so kill the process in such a way that as well as a backtrace, I also get something useful like the last Lua statement that was being evaluated, but I'm not sure which API calls would be appropriate at that point in luaD_precall().

Cheers,
Chris

On 17 April 2018 at 22:42, Luiz Henrique de Figueiredo <[hidden email]> wrote:
If you can, rebuilt Lua with LUA_USE_APICHECK on. It may help locate
the problem.




--
Cheers,

Chris