Reverted part of 2011-01-08T20:40:28Z!koraq@xs4all.nl, since it opened a major security breach...

...in Wesnoth.

Indeed, it caused the Lua engine to skip unwinding of its state in
presence of an exception, which opened the way to several attacks.

For instance, setting gc finalizers and then forcing GUI2 to throw an
exception would allow a multiplayer scenario to execute arbitrary code
on a remote client.
This commit is contained in:
Guillaume Melquiond 2011-01-09 00:32:39 +00:00
parent d2d883f25b
commit cb339ce30a

View file

@ -8,8 +8,6 @@
#ifndef lconfig_h
#define lconfig_h
#include "wml_exception.hpp"
#include <limits.h>
#include <stddef.h>
@ -613,15 +611,11 @@ union luai_Cast { double l_d; long l_l; };
** and with longjmp/setjmp otherwise.
*/
#if defined(__cplusplus)
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
#define LUAI_TRY(L,c,a) try { \
try { a } catch(const std::exception &e) \
{ lua_pushstring(L, e.what()); luaG_errormsg(L); throw; } \
} catch(twml_exception&) { \
throw; \
} catch(...) \
{ if ((c)->status == 0) (c)->status = -1; }
#define luai_jmpbuf int /* dummy variable */