From 267ef461d0b13aa28d667f12d1a61452c9db529c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 20 May 2025 17:55:08 -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 aebddaf7..1ac82990 100644 --- a/lparser.c +++ b/lparser.c @@ -849,12 +849,11 @@ static void recfield (LexState *ls, ConsControl *cc) { FuncState *fs = ls->fs; int reg = ls->fs->freereg; expdesc tab, key, val; - if (ls->t.token == TK_NAME) { - checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + if (ls->t.token == TK_NAME) codename(ls, &key); - } else /* ls->t.token == '[' */ yindex(ls, &key); + checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); cc->nh++; checknext(ls, '='); tab = *cc->t; -- cgit v1.2.3-55-g6feb