From c15543b9afa31ab5dc564511ae11acd808405e8f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 20 May 2025 17:50:56 -0300 Subject: Bug: check for constructor overflow in [exp] fields The check for constructor overflow was considering only fields with explicit names, ignoring fields with syntax '[exp]=exp'. --- lparser.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index e868e887..992d45bd 100644 --- a/lparser.c +++ b/lparser.c @@ -904,12 +904,11 @@ static void recfield (LexState *ls, ConsControl *cc) { FuncState *fs = ls->fs; lu_byte reg = ls->fs->freereg; expdesc tab, key, val; - if (ls->t.token == TK_NAME) { - luaY_checklimit(fs, cc->nh, INT_MAX / 2, "items in a constructor"); + if (ls->t.token == TK_NAME) codename(ls, &key); - } else /* ls->t.token == '[' */ yindex(ls, &key); + luaY_checklimit(fs, cc->nh, INT_MAX / 2, "items in a constructor"); cc->nh++; checknext(ls, '='); tab = *cc->t; -- cgit v1.2.3-55-g6feb