lua-users home
lua-l archive

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


On Wed, 22 Aug 2001, Edgar Toernig wrote:

> [...]
> The possibly raised errors in your first example are:
>
>  - lua_getglobal may invoke tag methods and by that executes arbitrary
>    code and can generate all kind of errors.
>
>  - lua_pushstring may get an out of memory error.
>
>  - lua_getglobal and lua_pushstring may get a stack overflow.
>
>  - If you'd used lua_tostring instead of lua_tonumber you could get
>    an out of memory there too.
>
> [...]
> Unfortunately it's pretty difficult to protect against these errors.

The first error can be avoided calling lua_rawget, instead of
lua_getglobal. Stack overflows can be avoided checking stack space before
the call (lua_stackspace). That leave us only with out of memory
errors. Those are really hard to protect in the current implementation.

-- Roberto