Skip to content

Commit

Permalink
fuzzing: reject out-of-bounds unbox slot numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Apr 18, 2019
1 parent 6544179 commit 8fef199
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/6model/reprs/P6opaque.c
Expand Up @@ -1035,8 +1035,12 @@ static void deserialize_repr_data(MVMThreadContext *tc, MVMSTable *st, MVMSerial
for (i = 0; i < repr_data->num_attributes; i++) {
MVMuint16 repr_id = MVM_serialization_read_int(tc, reader);
MVMuint16 slot = MVM_serialization_read_int(tc, reader);
if (slot > repr_data->num_attributes)
MVM_exception_throw_adhoc(tc, "Serialization error: P6opaque's unbox slot out of range (slot %d > %d attributes).", slot, repr_data->num_attributes);
if (repr_id < MVM_REPR_MAX_COUNT)
repr_data->unbox_slots[repr_id] = slot;
else
MVM_exception_throw_adhoc(tc, "Serialization error: P6opaque's unbox slot repr id out of range.");
}
} else {
repr_data->unbox_slots = NULL;
Expand Down

0 comments on commit 8fef199

Please sign in to comment.