Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Correctly give an error message only when PC is invalid

  • Loading branch information...
commit ecbfb0835e2d08fd8ed1117f9cc1fa6963391ddd 1 parent 802f2d3
@leto leto authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/m0/c/ops.c
View
6 src/m0/c/ops.c
@@ -409,9 +409,11 @@ run_ops( M0_Interp *interp, M0_CallFrame *cf ) {
(const unsigned long)cf->registers[PC];
const unsigned long op_count = bytecode->op_count;
- /* XXX: access violation -- so produce an error? */
- if (pc >= op_count) {
+ if ((pc > op_count) || (pc < 0)) {
+ /* XXX TODO: Test this */
fprintf( stderr, "M0: Invalid PC (Program Counter)!\n");
+ return 1;
+ } else if (pc == op_count) {
return 0;
} else {
const unsigned char op = ops[4*pc];
Please sign in to comment.
Something went wrong with that request. Please try again.