aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-20 17:50:56 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-20 17:50:56 -0300
commitc15543b9afa31ab5dc564511ae11acd808405e8f (patch)
tree61adad4a35a283342abd8366b9fbed1fadcab423 /lparser.c
parentbe05c444818989463dc307eed283503d391f93eb (diff)
downloadlua-c15543b9afa31ab5dc564511ae11acd808405e8f.tar.gz
lua-c15543b9afa31ab5dc564511ae11acd808405e8f.tar.bz2
lua-c15543b9afa31ab5dc564511ae11acd808405e8f.zip
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'.
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c5
1 files changed, 2 insertions, 3 deletions
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) {
904 FuncState *fs = ls->fs; 904 FuncState *fs = ls->fs;
905 lu_byte reg = ls->fs->freereg; 905 lu_byte reg = ls->fs->freereg;
906 expdesc tab, key, val; 906 expdesc tab, key, val;
907 if (ls->t.token == TK_NAME) { 907 if (ls->t.token == TK_NAME)
908 luaY_checklimit(fs, cc->nh, INT_MAX / 2, "items in a constructor");
909 codename(ls, &key); 908 codename(ls, &key);
910 }
911 else /* ls->t.token == '[' */ 909 else /* ls->t.token == '[' */
912 yindex(ls, &key); 910 yindex(ls, &key);
911 luaY_checklimit(fs, cc->nh, INT_MAX / 2, "items in a constructor");
913 cc->nh++; 912 cc->nh++;
914 checknext(ls, '='); 913 checknext(ls, '=');
915 tab = *cc->t; 914 tab = *cc->t;