From 5cb6037d49cbbde936505a705e37d4962c91b28a Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 7 Oct 2004 14:27:00 -0300 Subject: [PATCH] cannot jump to a setlist count --- ldebug.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ldebug.c b/ldebug.c index 36c5c391..1db6d4d0 100644 --- a/ldebug.c +++ b/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; }