mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 01:52:43 +00:00
add missing sanity depth checking to obj getters
This commit is contained in:
parent
46a12cef9b
commit
0695a532b7
1 changed files with 4 additions and 0 deletions
|
|
@ -112,9 +112,11 @@ Trajectory* get_trajectory(const char* name) {
|
|||
|
||||
struct Object *obj_get_first(enum ObjectList objList) {
|
||||
if (gObjectLists && objList >= 0 && objList < NUM_OBJ_LISTS) {
|
||||
u32 sanityDepth = 0;
|
||||
struct Object *head = (struct Object *) &gObjectLists[objList];
|
||||
struct Object *obj = (struct Object *) head->header.next;
|
||||
while (obj != head) {
|
||||
if (++sanityDepth > 10000) { break; }
|
||||
if (obj->activeFlags != ACTIVE_FLAG_DEACTIVATED) {
|
||||
return obj;
|
||||
}
|
||||
|
|
@ -126,9 +128,11 @@ struct Object *obj_get_first(enum ObjectList objList) {
|
|||
|
||||
static struct Object *obj_get_next_internal(struct Object *o, enum ObjectList objList) {
|
||||
if (gObjectLists && o) {
|
||||
u32 sanityDepth = 0;
|
||||
struct Object *head = (struct Object *) &gObjectLists[objList];
|
||||
struct Object *next = (struct Object *) o->header.next;
|
||||
while (next != head) {
|
||||
if (++sanityDepth > 10000) { break; }
|
||||
if (next->activeFlags != ACTIVE_FLAG_DEACTIVATED) {
|
||||
return next;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue