diff options
author | Mike Pall <mike> | 2023-08-28 21:00:37 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-08-28 21:00:37 +0200 |
commit | 309fb42b871b6414f53e0e0e708bce0b0d62daff (patch) | |
tree | f38b61e87527af5ac14ce496959868abec26a2d1 | |
parent | d0ce82ecdcf0fcfb766e207eac6b7622680817b2 (diff) | |
download | luajit-309fb42b871b6414f53e0e0e708bce0b0d62daff.tar.gz luajit-309fb42b871b6414f53e0e0e708bce0b0d62daff.tar.bz2 luajit-309fb42b871b6414f53e0e0e708bce0b0d62daff.zip |
Fix predict_next() in parser (again).
Reported by Sergey Bronnikov. #1054
-rw-r--r-- | src/lj_parse.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lj_parse.c b/src/lj_parse.c index c0cbd261..afdbcc3d 100644 --- a/src/lj_parse.c +++ b/src/lj_parse.c | |||
@@ -2527,9 +2527,11 @@ static void parse_for_num(LexState *ls, GCstr *varname, BCLine line) | |||
2527 | */ | 2527 | */ |
2528 | static int predict_next(LexState *ls, FuncState *fs, BCPos pc) | 2528 | static int predict_next(LexState *ls, FuncState *fs, BCPos pc) |
2529 | { | 2529 | { |
2530 | BCIns ins = fs->bcbase[pc].ins; | 2530 | BCIns ins; |
2531 | GCstr *name; | 2531 | GCstr *name; |
2532 | cTValue *o; | 2532 | cTValue *o; |
2533 | if (pc >= fs->bclim) return 0; | ||
2534 | ins = fs->bcbase[pc].ins; | ||
2533 | switch (bc_op(ins)) { | 2535 | switch (bc_op(ins)) { |
2534 | case BC_MOV: | 2536 | case BC_MOV: |
2535 | if (bc_d(ins) >= fs->nactvar) return 0; | 2537 | if (bc_d(ins) >= fs->nactvar) return 0; |