diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-22 11:08:28 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-22 11:08:28 -0200 |
| commit | d8b0bbb2ada3b4ffa59888f740f9a8d7c3eef8f7 (patch) | |
| tree | f8e959df66c405c84e138061ed79c85dda02aa1b /opcode.c | |
| parent | 1f4ee4a4d2462edbb1e0811ef1e317f4778e619d (diff) | |
| download | lua-d8b0bbb2ada3b4ffa59888f740f9a8d7c3eef8f7.tar.gz lua-d8b0bbb2ada3b4ffa59888f740f9a8d7c3eef8f7.tar.bz2 lua-d8b0bbb2ada3b4ffa59888f740f9a8d7c3eef8f7.zip | |
BUG: pointer arithmetic does not have to work when pointing outside
an array.
Diffstat (limited to 'opcode.c')
| -rw-r--r-- | opcode.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 3.76 1996/09/24 21:46:44 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.77 1996/11/18 13:48:44 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| @@ -399,11 +399,11 @@ void lua_error (char *s) | |||
| 399 | 399 | ||
| 400 | lua_Function lua_stackedfunction (int level) | 400 | lua_Function lua_stackedfunction (int level) |
| 401 | { | 401 | { |
| 402 | Object *p = top; | 402 | StkId i; |
| 403 | while (--p >= stack) | 403 | for (i = (top-1)-stack; i>=0; i--) |
| 404 | if (p->tag == LUA_T_MARK || p->tag == LUA_T_CMARK) | 404 | if (stack[i].tag == LUA_T_MARK || stack[i].tag == LUA_T_CMARK) |
| 405 | if (level-- == 0) | 405 | if (level-- == 0) |
| 406 | return Ref(p); | 406 | return Ref(stack+i); |
| 407 | return LUA_NOOBJECT; | 407 | return LUA_NOOBJECT; |
| 408 | } | 408 | } |
| 409 | 409 | ||
