Skip to content

Commit

Permalink
Fix loading bytecode on big endian systems
Browse files Browse the repository at this point in the history
We used to check the value before it got endian-switched
by validate_operand. Move the check after the switch and
fix the offset to match.
  • Loading branch information
gerd authored and timo committed Apr 6, 2018
1 parent d115bf7 commit d44fa89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/validation.c
Expand Up @@ -406,9 +406,9 @@ static void validate_operands(Validator *val) {
case MVM_OP_wval:
case MVM_OP_wval_wide: {
validate_reg_operand(val, operands[0]);
if (GET_UI16(val->cur_op, 0) >= val->cu->body.num_scs)
fail(val, MSG(val, "out of range SC index %u"), GET_UI16(val->cur_op, 0));
validate_literal_operand(val, operands[1]);
if (GET_UI16(val->cur_op, -2) >= val->cu->body.num_scs)
fail(val, MSG(val, "out of range SC index %u"), GET_UI16(val->cur_op, -2));
validate_literal_operand(val, operands[2]);
break;
}
Expand Down

0 comments on commit d44fa89

Please sign in to comment.