From 5ae29afdeb3855c6c87563300532d6b8fee157c2 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Fri, 22 Sep 2023 20:52:31 +0200 Subject: [PATCH] port: fix some pointer ub in bg.c --- src/game/bg.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/bg.c b/src/game/bg.c index 58c1ead38..1ee68c305 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -3865,7 +3865,11 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, #endif texturenum = -1; } else { +#ifdef PLATFORM_N64 s32 tmp = PHYS_TO_K0(UNSEGADDR(imggdl->words.w1) - 8); +#else + uintptr_t tmp = PHYS_TO_K0(UNSEGADDR(imggdl->words.w1) - 8); +#endif texturenum = *(s16 *) tmp; } @@ -4366,7 +4370,11 @@ bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *a #endif texturenum = -1; } else { +#ifdef PLATFORM_N64 s32 tmp = UNSEGADDR(tmpgdl->words.w1) - 8; +#else + uintptr_t tmp = UNSEGADDR(tmpgdl->words.w1) - 8; +#endif texturenum = *(s16 *) PHYS_TO_K0(tmp); }