[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Corrupted pointer in luaD_precall after stack grow/reallocation
- From: Mike Pall <mikelu-1110@...>
- Date: Sat, 15 Oct 2011 17:29:26 +0200
ijsf wrote:
> I have recently noticed a serious problem in Lua 5.1.4's luaD_precall
> function using Valgrind.
> [...]
> ==28698== at 0x9ABD: luaD_precall (ldo.c:455)
> ==28698== by 0x9D8B: luaD_call (ldo.c:518)
> ==28698== by 0x1736A: callTMres (lvm.c:110)
The line numbers you're quoting do not correspond to the official
release of Lua 5.1.4, nor any other release I could find.
> Basically, what's happening is the following (luaD_precall):
>
> ...
> else { /* if is a C function, call it */
> CallInfo *ci;
> int n;
> luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
>
> During the call, apparently the stack is too small, so luaD_checkstack
> calls luaD_growstack (as you can see in the valgrind log). That's all
> fine, and luaD_precall continues:
>
> ...
> if (ttisfunction(func))
This does not correspond to the control flow in the original Lua
sources. The original sources check for that _before_ deciding
whether it's a C function or not. Actually, one has to do it in
that order, so the above doesn't make any sense.
In other words: you're probably using some heavily butchered
variant of the Lua sources. And someone broke it, too. Please
check where you got that from and complain loudly. The official
sources are not affected.
--Mike