From 5bf31ef8d78d91e73af9a4bb123dae8e259e2cf9 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:11:25 -0400 Subject: [PATCH] prevent OOB write for BGM fix in grotto mixed pools --- soh/soh/Enhancements/randomizer/randomizer_entrance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.c b/soh/soh/Enhancements/randomizer/randomizer_entrance.c index faec117eb..e32223124 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.c +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.c @@ -253,7 +253,9 @@ void Entrance_Init(void) { for (s16 i = 0; i < 4; i++) { // Zero out the bit in the field which tells the game to keep playing // background music for all four scene setups at each index - gEntranceTable[override + i].field &= ~ENTRANCE_INFO_CONTINUE_BGM_FLAG; + if (override + i < ENTRANCE_TABLE_SIZE) { + gEntranceTable[override + i].field &= ~ENTRANCE_INFO_CONTINUE_BGM_FLAG; + } } } }