diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-20 17:55:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-20 17:55:08 -0300 |
commit | 267ef461d0b13aa28d667f12d1a61452c9db529c (patch) | |
tree | b2d8bb8390a04357419bd89df521e96ec28f25a3 /lparser.c | |
parent | d1ee2a4deb06a335b9ff99530917b828a7ebe3e5 (diff) | |
download | lua-267ef461d0b13aa28d667f12d1a61452c9db529c.tar.gz lua-267ef461d0b13aa28d667f12d1a61452c9db529c.tar.bz2 lua-267ef461d0b13aa28d667f12d1a61452c9db529c.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 '')
-rw-r--r-- | lparser.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -849,12 +849,11 @@ static void recfield (LexState *ls, ConsControl *cc) { | |||
849 | FuncState *fs = ls->fs; | 849 | FuncState *fs = ls->fs; |
850 | int reg = ls->fs->freereg; | 850 | int reg = ls->fs->freereg; |
851 | expdesc tab, key, val; | 851 | expdesc tab, key, val; |
852 | if (ls->t.token == TK_NAME) { | 852 | if (ls->t.token == TK_NAME) |
853 | checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); | ||
854 | codename(ls, &key); | 853 | codename(ls, &key); |
855 | } | ||
856 | else /* ls->t.token == '[' */ | 854 | else /* ls->t.token == '[' */ |
857 | yindex(ls, &key); | 855 | yindex(ls, &key); |
856 | checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); | ||
858 | cc->nh++; | 857 | cc->nh++; |
859 | checknext(ls, '='); | 858 | checknext(ls, '='); |
860 | tab = *cc->t; | 859 | tab = *cc->t; |