Skip to content

Commit

Permalink
check max member count in class
Browse files Browse the repository at this point in the history
  • Loading branch information
albertodemichelis committed Sep 16, 2021
1 parent cf05167 commit 23a0620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions squirrel/sqclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr
_defaultvalues[_member_idx(temp)].val = val;
return true;
}
if (_members->CountUsed() >= MEMBER_MAX_COUNT) {
return false;
}
if(belongs_to_static_table) {
SQInteger mmidx;
if((sq_type(val) == OT_CLOSURE || sq_type(val) == OT_NATIVECLOSURE) &&
Expand Down
1 change: 1 addition & 0 deletions squirrel/sqclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef sqvector<SQClassMember> SQClassMemberVec;

#define MEMBER_TYPE_METHOD 0x01000000
#define MEMBER_TYPE_FIELD 0x02000000
#define MEMBER_MAX_COUNT 0x00FFFFFF

#define _ismethod(o) (_integer(o)&MEMBER_TYPE_METHOD)
#define _isfield(o) (_integer(o)&MEMBER_TYPE_FIELD)
Expand Down

0 comments on commit 23a0620

Please sign in to comment.