lua-users home
lua-l archive

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


erm. I remembered the api_check() macro in lapi.c, and enabled it, just in
case. And sure enough, I found two bugs in my code:
- one lua_pcall() where the error function index was below the bottom of the
stack by 1 position (I pushed the error function, the function to call, 1
argument, and told pcall that the error function was at index -4). Still I
just can't understand the error function could be called in case of error
(which it did perfectly...)
- a place in the debug hook where an object was pushed on the stack but not
popped afterward. Since the debugger makes use of the registry to store
breakpoints and stuff, it is very likely that this additional element caused
a stack overflow. What are the number of stack positions that are available
in the debug hook ?

Anyway, fixing those bugs solved the crash.

> -----Message d'origine-----
> De : Roberto Ierusalimschy [mailto:roberto@inf.puc-rio.br]
> Envoyé : vendredi 31 janvier 2003 11:00
> À : Multiple recipients of list
> Objet : Re: is this a bug in lua core 5.0b ?
> 
> 
> > Unfortunately, we can see that luaG_errormsg pushes two 
> objects on the
> > stack, and resizes it only afterward:
> 
> This shouldn't be a bug. The stack has some extra space 
> (EXTRA_STACK) to
> enable these kind of thing.
> 
> But I did not understand your calculations. You said that
> 
> > L->top-L->stack        181
> 
> Is sizeof(lua_TObject)==8 in your program?? If it is, L->top 
> is already
> seven positions after L->stack_last, which should not happen. 
> (If it is
> not, L->top is corrupted.)
> 
> -- Roberto
>