aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-06-04 09:54:31 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-06-04 09:54:31 -0300
commit519c57d597625f010d1bbb3f91bac5d193111060 (patch)
tree5f218af5cfd7b633935ece8f7223f86397193460
parentc15543b9afa31ab5dc564511ae11acd808405e8f (diff)
downloadlua-519c57d597625f010d1bbb3f91bac5d193111060.tar.gz
lua-519c57d597625f010d1bbb3f91bac5d193111060.tar.bz2
lua-519c57d597625f010d1bbb3f91bac5d193111060.zip
Removed uneeded check in parser
In a constructor, each field generates at least one opcode, and the number of opcodes is limited by INT_MAX. Therefore, the counters for number of fields cannot exceed this limit. (The current limit for items in the hash part of a table has a limit smaller than INT_MAX. However, as long as there are no overflows, the logic for table resizing will handle that limit.)
-rw-r--r--lparser.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/lparser.c b/lparser.c
index 992d45bd..9abaa374 100644
--- a/lparser.c
+++ b/lparser.c
@@ -908,7 +908,6 @@ static void recfield (LexState *ls, ConsControl *cc) {
908 codename(ls, &key); 908 codename(ls, &key);
909 else /* ls->t.token == '[' */ 909 else /* ls->t.token == '[' */
910 yindex(ls, &key); 910 yindex(ls, &key);
911 luaY_checklimit(fs, cc->nh, INT_MAX / 2, "items in a constructor");
912 cc->nh++; 911 cc->nh++;
913 checknext(ls, '='); 912 checknext(ls, '=');
914 tab = *cc->t; 913 tab = *cc->t;