[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_getinfo("n") crashes if "luac -s" is used
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 13 Dec 2004 22:34:08 -0200
On Mon, Dec 13, 2004 at 11:05:39AM -0600, Tim Gogolin wrote:
> What is the expected behavior of lua_getinfo(L, "n", &ar) if the name
> information has been stripped from the lua code via the "luac -s"
> command line compiler?
>
> I had been hoping to merely receive useless or empty strings, but
> instead my program is crashing in lua_getinfo() as auxgetinfo() passes
> NULL as the address of the buffer for getfuncname to write into.
Sorry, this is a bug. I think that the problem is at ldebug.c:480:
*name = getstr(p->upvalues[u]);
A quick fix is
*name = (p->upvalues==NULL) ? "?" : getstr(p->upvalues[u]);
Thanks for spotting this.
--lhf