lua-users home
lua-l archive

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


That sounds like a very useful tip - thanks
jwb

On 4 Apr 2003 at 17:29, Benoit Germain wrote:

> I've had a few bugs myself because of invalid indexes I provided to the lua
> API which silently accepted them. A way to catch this is to activate the
> api_check() macro in lapi.c. Once all complaints from this macro disappear,
> the random memory corruptions I experienced disappeared as well :-)
> 
> 
> Cheers,
> 
> 
> Benoit.
> 
> -----Message d'origine-----
> De : j.wattam-bell@ucl.ac.uk [mailto:j.wattam-bell@ucl.ac.uk]
> Envoyi : vendredi 4 avril 2003 16:23
> @ : Multiple recipients of list
> Objet : a (sort of) bug in Lua 5b?
> 
> 
> I just got an address exception in the Lua 5b api. It happened when calling 
> lua_getmetatable with an invalid stack index.
> 
> The problem seems to be that with an invalid index, ttype(obj) in the switch
> 
> statement (in lua_getmetatable) has a null argument.
> 
> I guess it's stretching a point to call this a bug - I should check the
> index 
> before calling the function - but Lua is usually so polite and forbearing
> when 
> subjected to this kind of maltreatment. And I apologise for raising it at
> this 
> late stage.
> 
> jwb
>