lua-users home
lua-l archive

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


Roman Gershman <romange@gmail.com> writes:

> I wrote a sanitization procedure that checks the depth of the returned
> lua expression. The snippet below assumes that there is a lua table on
> the top of the stack.
>
> [...]
>
> My procedure finishes successfully and unwinds the stack to its
> original position. Any thoughts ?

Without checking the details of your code: this looks like a overflow of
the Lua stack. You'll want to place some calls to lua_checkstack (or
luaL_checkstack) somewhere in there.

Also consider compiling your code with `-DLUA_USE_APICHECK` when
testing: this will make it more likely for you to catch errors like
these, as Lua won't always crash even though the stack may already be
overflowing.

Cheers,
Albert

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124