diff options
author | rubidium <rubidium@openttd.org> | 2013-07-11 17:29:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-07-11 17:29:51 +0000 |
commit | 2d459b2fc0f6947985cfb51deb5e17f82091ae3b (patch) | |
tree | 4a7639a9fab9ec97f0b7e2e73ed47083e2e91959 /src | |
parent | 56a899f4bd6be2cc87bcb14736d75f7ccde78a06 (diff) | |
download | openttd-2d459b2fc0f6947985cfb51deb5e17f82091ae3b.tar.xz |
(svn r25585) -Fix [FS#5320]: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqvm.cpp | 1 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqvm.h | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp index 9041c7986..c8f4db674 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.cpp +++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp @@ -107,6 +107,7 @@ SQVM::SQVM(SQSharedState *ss) _errorhandler = _null_; _debughook = _null_; _can_suspend = false; + _in_stackoverflow = false; _ops_till_suspend = 0; ci = NULL; INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h index 4b922c370..d272d152e 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.h +++ b/src/3rdparty/squirrel/squirrel/sqvm.h @@ -170,6 +170,7 @@ public: SQBool _can_suspend; SQInteger _ops_till_suspend; + SQBool _in_stackoverflow; bool ShouldSuspend() { @@ -200,8 +201,10 @@ inline SQObjectPtr &stack_get(HSQUIRRELVM v,SQInteger idx){return ((idx>=0)?(v-> #define PUSH_CALLINFO(v,nci){ \ if(v->_callsstacksize == v->_alloccallsstacksize) { \ - if (v->_callsstacksize > 65535) {\ + if (v->_callsstacksize > 65535 && !v->_in_stackoverflow) {\ + v->_in_stackoverflow = true; \ v->Raise_Error(_SC("stack overflow"));\ + v->CallErrorHandler(v->_lasterror);\ return false;\ }\ v->GrowCallStack(); \ |