浏览代码

cannot jump to a setlist count

Roberto Ierusalimschy 21 年之前
父节点
当前提交
5cb6037d49
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      ldebug.c

+ 8 - 2
ldebug.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldebug.c,v 2.8 2004/09/01 13:47:31 roberto Exp $
+** $Id: ldebug.c,v 2.9 2004/10/04 19:04:34 roberto Exp roberto $
 ** Debug Interface
 ** See Copyright Notice in lua.h
 */
@@ -315,6 +315,11 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) {
         if (getBMode(op) == OpArgR) {
           int dest = pc+1+b;
           check(0 <= dest && dest < pt->sizecode);
+          if (dest > 0) {
+            /* cannot jump to a setlist count */
+            const Instruction d = pt->code[dest-1];
+            check(!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0));
+          }
         }
         break;
       }
@@ -356,7 +361,8 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) {
         break;
       }
       case OP_TFORLOOP: {
-        checkreg(pt, a+5);  /* space for control variables */
+        check(c >= 1);  /* at least one result (control variable) */
+        checkreg(pt, a+3+c);  /* space for results */
         if (reg >= a+3) last = pc;  /* affect all regs above its call base */
         break;
       }