Skip to content

Commit 23a0620

Browse files
author
albertodemichelis
committed
check max member count in class
1 parent cf05167 commit 23a0620

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: squirrel/sqclass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr
6161
_defaultvalues[_member_idx(temp)].val = val;
6262
return true;
6363
}
64+
if (_members->CountUsed() >= MEMBER_MAX_COUNT) {
65+
return false;
66+
}
6467
if(belongs_to_static_table) {
6568
SQInteger mmidx;
6669
if((sq_type(val) == OT_CLOSURE || sq_type(val) == OT_NATIVECLOSURE) &&

Diff for: squirrel/sqclass.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ typedef sqvector<SQClassMember> SQClassMemberVec;
1717

1818
#define MEMBER_TYPE_METHOD 0x01000000
1919
#define MEMBER_TYPE_FIELD 0x02000000
20+
#define MEMBER_MAX_COUNT 0x00FFFFFF
2021

2122
#define _ismethod(o) (_integer(o)&MEMBER_TYPE_METHOD)
2223
#define _isfield(o) (_integer(o)&MEMBER_TYPE_FIELD)

0 commit comments

Comments
 (0)