1
0
Fork 0

(svn r25585) -Fix [FS#5320]: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full

release/1.4
rubidium 2013-07-11 17:29:51 +00:00
parent 56a899f4bd
commit 2d459b2fc0
2 changed files with 5 additions and 1 deletions

View File

@ -107,6 +107,7 @@ SQVM::SQVM(SQSharedState *ss)
_errorhandler = _null_; _errorhandler = _null_;
_debughook = _null_; _debughook = _null_;
_can_suspend = false; _can_suspend = false;
_in_stackoverflow = false;
_ops_till_suspend = 0; _ops_till_suspend = 0;
ci = NULL; ci = NULL;
INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);

View File

@ -170,6 +170,7 @@ public:
SQBool _can_suspend; SQBool _can_suspend;
SQInteger _ops_till_suspend; SQInteger _ops_till_suspend;
SQBool _in_stackoverflow;
bool ShouldSuspend() bool ShouldSuspend()
{ {
@ -200,8 +201,10 @@ inline SQObjectPtr &stack_get(HSQUIRRELVM v,SQInteger idx){return ((idx>=0)?(v->
#define PUSH_CALLINFO(v,nci){ \ #define PUSH_CALLINFO(v,nci){ \
if(v->_callsstacksize == v->_alloccallsstacksize) { \ 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->Raise_Error(_SC("stack overflow"));\
v->CallErrorHandler(v->_lasterror);\
return false;\ return false;\
}\ }\
v->GrowCallStack(); \ v->GrowCallStack(); \