diff options
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 21 |
1 files changed, 17 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.97 2002/01/09 22:02:47 roberto Exp $ | 2 | ** $Id: ldebug.c,v 1.100 2002/02/05 22:39:12 roberto Exp $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -375,9 +375,10 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 375 | check(c < MAXSTACK && b < c); | 375 | check(c < MAXSTACK && b < c); |
| 376 | break; | 376 | break; |
| 377 | } | 377 | } |
| 378 | case OP_JMP: | ||
| 379 | case OP_FORLOOP: | 378 | case OP_FORLOOP: |
| 380 | case OP_TFORLOOP: { | 379 | checkreg(pt, a+2); |
| 380 | /* go through */ | ||
| 381 | case OP_JMP: { | ||
| 381 | int dest = pc+1+b; | 382 | int dest = pc+1+b; |
| 382 | check(0 <= dest && dest < pt->sizecode); | 383 | check(0 <= dest && dest < pt->sizecode); |
| 383 | /* not full check and jump is forward and do not skip `lastpc'? */ | 384 | /* not full check and jump is forward and do not skip `lastpc'? */ |
| @@ -385,6 +386,12 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 385 | pc += b; /* do the jump */ | 386 | pc += b; /* do the jump */ |
| 386 | break; | 387 | break; |
| 387 | } | 388 | } |
| 389 | case OP_TFORLOOP: { | ||
| 390 | checkreg(pt, a+c); | ||
| 391 | checkreg(pt, a+2); /* at least 2 for table generators */ | ||
| 392 | check(pc+2 < pt->sizecode); /* check skip */ | ||
| 393 | break; | ||
| 394 | } | ||
| 388 | case OP_CALL: { | 395 | case OP_CALL: { |
| 389 | if (b != 0) { | 396 | if (b != 0) { |
| 390 | checkreg(pt, a+b-1); | 397 | checkreg(pt, a+b-1); |
| @@ -408,8 +415,14 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 408 | break; | 415 | break; |
| 409 | } | 416 | } |
| 410 | case OP_CLOSURE: { | 417 | case OP_CLOSURE: { |
| 418 | int nup; | ||
| 411 | check(b < pt->sizep); | 419 | check(b < pt->sizep); |
| 412 | check(pc + pt->p[b]->nupvalues < pt->sizecode); | 420 | nup = pt->p[b]->nupvalues; |
| 421 | check(pc + nup < pt->sizecode); | ||
| 422 | for (; nup>0; nup--) { | ||
| 423 | OpCode op1 = GET_OPCODE(pt->code[pc+nup]); | ||
| 424 | check(op1 == OP_GETUPVAL || op1 == OP_MOVE); | ||
| 425 | } | ||
| 413 | break; | 426 | break; |
| 414 | } | 427 | } |
| 415 | default: break; | 428 | default: break; |
