diff --git a/lang/object.c b/lang/object.c index 9a721b7..948903a 100644 --- a/lang/object.c +++ b/lang/object.c @@ -99,11 +99,17 @@ } void object_list_set(VmState state, ObjectList list, int index, Object obj) { + vm_abort_if(state, index < 0, "object_list_get: index too small"); + vm_abort_if(state, index >= list->length, + "object_list_get: index too large"); object_drop(state, &(list->elems[index])); list->elems[index] = obj; } Object object_list_get(VmState state, ObjectList list, int index) { + vm_abort_if(state, index < 0, "object_list_get: index too small"); + vm_abort_if(state, index >= list->length, + "object_list_get: index too large"); Object obj = list->elems[index]; object_hold(state, obj); return obj;