Fix predict_next() in parser (again).

Reported by Sergey Bronnikov. #1054
This commit is contained in:
Mike Pall 2023-08-28 21:00:37 +02:00
parent d0ce82ecdc
commit 309fb42b87

View File

@ -2527,9 +2527,11 @@ static void parse_for_num(LexState *ls, GCstr *varname, BCLine line)
*/ */
static int predict_next(LexState *ls, FuncState *fs, BCPos pc) static int predict_next(LexState *ls, FuncState *fs, BCPos pc)
{ {
BCIns ins = fs->bcbase[pc].ins; BCIns ins;
GCstr *name; GCstr *name;
cTValue *o; cTValue *o;
if (pc >= fs->bclim) return 0;
ins = fs->bcbase[pc].ins;
switch (bc_op(ins)) { switch (bc_op(ins)) {
case BC_MOV: case BC_MOV:
if (bc_d(ins) >= fs->nactvar) return 0; if (bc_d(ins) >= fs->nactvar) return 0;