[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: longjmp and state
- From: LEGO <luis.ontanon@...>
- Date: Thu, 26 Jan 2006 14:41:51 +0100
On 1/26/06, Roberto Ierusalimschy <email@example.com> wrote:
> > If a routime called by a lua_CFunction longjmps way back (bellow the
> > point where the lua machine was called) would the lua machine be
> > still usable?
> Not exactly... The thread that did the longjmp should not be used.
> You could use other threads, but I am not sure whether that would
> be completely safe either.
> > If it doesn't, Is there a way to protect the machine from such
> > backward jumps .
> How do you protect them in ethereal?
We set a longjump (point A) in the function that calls the frame
dissector (the dissection root). If some of the dissectors bails out,
by either failing an ASSERTION or reading out of bounds in the
curtrent buffer (the packet's one), the control jumps back to point A.
As dissectors use our own *alloc() routines we do not risk leaking
because per packet allocated chunks are safely freed after point A.
BTW I think that what I'll do is to push a "point B" in the function
called by lua before calling any risky code and hanlde the
"exception" in right there that way I'll avoid the stack been popped
bellow that of the functions called by lua. It may be clumsy but that
avoids me to modify ethereal code's base, that way the embeded lua can
be "just" another ethereal plugin as I wanted it since the very
Thanks for the answer.
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan