lua-users home
lua-l archive

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


Thanks for the tip! 

On Sat, Feb 5, 2022 at 5:24 PM Albert Krewinkel <albert+lua@zeitkraut.de> wrote:
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


--
Best regards,
     Roman