Re: Preventing DOS when executing Lua code ...
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Preventing DOS when executing Lua code ...
- From: Gerald Gutierrez <gerald.gutierrez@...>
- Date: Mon, 3 Jul 2006 22:02:31 -0700
On 3-Jul-06, at 8:31 PM, Luiz Henrique de Figueiredo wrote:
My solution registers a hook function that executes based on the
count hook. It checks the current time and if execution has timed
out, it does a longjmp out of the interpreter and back into the host
application.
Why not simply call lua_error instead of longjmp? If you run Lua in a
cpcall cage, you can catch that error in the host app. That's what
lua.c
does. --lhf
Yes, a number of people have suggested this, and sounds like a good
idea. The documentation does not discuss implications of calling this
function inside a hook -- is it guaranteed to leave the interpreter
in a consistent state so that it can continue to be used without ill
effect? The second question is that since the hook is called based on
instruction count, are instructions "atomic" such that variables are
guaranteed to not be left in an inconsistent state?
Thanks.