mirror of https://github.com/OpenTTD/OpenTTD
Fix: Check max member count in squirrel classes (#10883)
Manual cherry-pick from 23a0620658
pull/10888/head
parent
8ea9c1a133
commit
c880157518
|
@ -65,6 +65,9 @@ bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr
|
||||||
_defaultvalues[_member_idx(temp)].val = val;
|
_defaultvalues[_member_idx(temp)].val = val;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (_members->CountUsed() >= MEMBER_MAX_COUNT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(type(val) == OT_CLOSURE || type(val) == OT_NATIVECLOSURE || bstatic) {
|
if(type(val) == OT_CLOSURE || type(val) == OT_NATIVECLOSURE || bstatic) {
|
||||||
SQInteger mmidx;
|
SQInteger mmidx;
|
||||||
if((type(val) == OT_CLOSURE || type(val) == OT_NATIVECLOSURE) &&
|
if((type(val) == OT_CLOSURE || type(val) == OT_NATIVECLOSURE) &&
|
||||||
|
|
|
@ -19,6 +19,7 @@ typedef sqvector<SQClassMember> SQClassMemberVec;
|
||||||
|
|
||||||
#define MEMBER_TYPE_METHOD 0x01000000
|
#define MEMBER_TYPE_METHOD 0x01000000
|
||||||
#define MEMBER_TYPE_FIELD 0x02000000
|
#define MEMBER_TYPE_FIELD 0x02000000
|
||||||
|
#define MEMBER_MAX_COUNT 0x00FFFFFF
|
||||||
|
|
||||||
#define _ismethod(o) (_integer(o)&MEMBER_TYPE_METHOD)
|
#define _ismethod(o) (_integer(o)&MEMBER_TYPE_METHOD)
|
||||||
#define _isfield(o) (_integer(o)&MEMBER_TYPE_FIELD)
|
#define _isfield(o) (_integer(o)&MEMBER_TYPE_FIELD)
|
||||||
|
|
Loading…
Reference in New Issue