(svn r25585) -Fix [FS#5320]: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full
authorrubidium
Thu, 11 Jul 2013 17:29:51 +0000
changeset 20554af6bb5abecbe
parent 20553 ad0ae87ef22f
child 20555 452d11268945
(svn r25585) -Fix [FS#5320]: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full
src/3rdparty/squirrel/squirrel/sqvm.cpp
src/3rdparty/squirrel/squirrel/sqvm.h
     1.1 --- a/src/3rdparty/squirrel/squirrel/sqvm.cpp	Wed Jul 10 17:46:54 2013 +0000
     1.2 +++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp	Thu Jul 11 17:29:51 2013 +0000
     1.3 @@ -107,6 +107,7 @@
     1.4  	_errorhandler = _null_;
     1.5  	_debughook = _null_;
     1.6  	_can_suspend = false;
     1.7 +	_in_stackoverflow = false;
     1.8  	_ops_till_suspend = 0;
     1.9  	ci = NULL;
    1.10  	INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);
     2.1 --- a/src/3rdparty/squirrel/squirrel/sqvm.h	Wed Jul 10 17:46:54 2013 +0000
     2.2 +++ b/src/3rdparty/squirrel/squirrel/sqvm.h	Thu Jul 11 17:29:51 2013 +0000
     2.3 @@ -170,6 +170,7 @@
     2.4  
     2.5  	SQBool _can_suspend;
     2.6  	SQInteger _ops_till_suspend;
     2.7 +	SQBool _in_stackoverflow;
     2.8  
     2.9  	bool ShouldSuspend()
    2.10  	{
    2.11 @@ -200,8 +201,10 @@
    2.12  
    2.13  #define PUSH_CALLINFO(v,nci){ \
    2.14  	if(v->_callsstacksize == v->_alloccallsstacksize) { \
    2.15 -		if (v->_callsstacksize > 65535) {\
    2.16 +		if (v->_callsstacksize > 65535 && !v->_in_stackoverflow) {\
    2.17 +			v->_in_stackoverflow = true; \
    2.18  			v->Raise_Error(_SC("stack overflow"));\
    2.19 +			v->CallErrorHandler(v->_lasterror);\
    2.20  			return false;\
    2.21  		}\
    2.22  		v->GrowCallStack(); \