Skip to content

Commit 934fdd4

Browse files
committed
Bug: Constructors with nils can overflow counters
1 parent 9ac9d23 commit 934fdd4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lparser.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,8 @@ static void constructor (LexState *ls, expdesc *t) {
940940
if (ls->t.token == '}') break;
941941
closelistfield(fs, &cc);
942942
field(ls, &cc);
943+
checklimit(fs, cc.tostore + cc.na + cc.nh, INT_MAX/2,
944+
"items in a constructor");
943945
} while (testnext(ls, ',') || testnext(ls, ';'));
944946
check_match(ls, '}', '{', line);
945947
lastlistfield(fs, &cc);

0 commit comments

Comments
 (0)