Initialization of too many locals break assertion
The check for limit of local variables is made after generating code to initialize them. If there are too many local variables not initialized, the coding of instruction OP_LOADNIL could overflow an argument.
This commit is contained in:
@@ -547,6 +547,7 @@ static void singlevar (LexState *ls, expdesc *var) {
|
||||
static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
|
||||
FuncState *fs = ls->fs;
|
||||
int needed = nvars - nexps; /* extra values needed */
|
||||
luaK_checkstack(fs, needed);
|
||||
if (hasmultret(e->k)) { /* last expression has multiple returns? */
|
||||
int extra = needed + 1; /* discount last expression itself */
|
||||
if (extra < 0)
|
||||
|
||||
Reference in New Issue
Block a user