Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Check for out of bounds. Fixes rakudo crash on "Buf.new.subbuf(0, 1)\;
  • Loading branch information
dagurval committed Aug 28, 2013
1 parent daae9b5 commit 360e781
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vm/parrot/6model/reprs/VMArray.c
Expand Up @@ -401,6 +401,11 @@ static void at_pos_native(PARROT_INTERP, STable *st, void *data, INTVAL index, N
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"VMArray: Can't get unboxed string value");

if (index >= body->elems) {
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
"VMArray: index out of bounds");
}

if(repr_data->elem_kind == STORAGE_SPEC_BP_INT) {
value->value.intval = get_pos_int(interp, body, repr_data, body->start + index);
}
Expand Down

0 comments on commit 360e781

Please sign in to comment.