equal
deleted
inserted
replaced
263 ** {====================================================== |
263 ** {====================================================== |
264 ** Symbolic Execution and code checker |
264 ** Symbolic Execution and code checker |
265 ** ======================================================= |
265 ** ======================================================= |
266 */ |
266 */ |
267 |
267 |
268 #define check(x) if (!(x)) return 0; |
268 #define check(x) if (!(x)) return 0; |
269 |
269 |
270 #define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) |
270 #define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) |
271 |
271 |
272 #define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) |
272 #define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) |
273 |
273 |
274 |
274 |
275 |
275 |
276 static int precheck (const Proto *pt) { |
276 static int precheck (const Proto *pt) { |
277 check(pt->maxstacksize <= MAXSTACK); |
277 check(pt->maxstacksize <= MAXSTACK); |
283 check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); |
283 check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); |
284 return 1; |
284 return 1; |
285 } |
285 } |
286 |
286 |
287 |
287 |
288 #define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) |
288 #define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) |
289 |
289 |
290 int luaG_checkopenop (Instruction i) { |
290 int luaG_checkopenop (Instruction i) { |
291 switch (GET_OPCODE(i)) { |
291 switch (GET_OPCODE(i)) { |
292 case OP_CALL: |
292 case OP_CALL: |
293 case OP_TAILCALL: |
293 case OP_TAILCALL: |