Avoid OOM allocation error from invalid too-high bank numbers

This commit is contained in:
Rangi
2026-08-22 18:31:26 -04:00
parent 8bc7de35f9
commit 0888600cb7
3 changed files with 11 additions and 7 deletions
+1
View File
@@ -72,6 +72,7 @@ void layout_SetSectionType(SectionType type, uint32_t bank) {
bank, bank,
typeInfo.lastBank typeInfo.lastBank
); );
bank = typeInfo.lastBank;
} }
setActiveTypeAndIdx(type, bank - typeInfo.firstBank); setActiveTypeAndIdx(type, bank - typeInfo.firstBank);
+1
View File
@@ -1,5 +1,6 @@
rom0 1 rom0 1
romx 0 romx 0
romx 0xffff_ffff
vram 2 vram 2
wram0 1 wram0 1
wramx 0 wramx 0
+9 -7
View File
@@ -2,16 +2,18 @@ error: ROM0 bank 1 does not exist (the maximum is 0)
at script-oob-bank-num.link(1) at script-oob-bank-num.link(1)
error: ROMX bank 0 does not exist (the minimum is 1) error: ROMX bank 0 does not exist (the minimum is 1)
at script-oob-bank-num.link(2) at script-oob-bank-num.link(2)
error: VRAM bank 2 does not exist (the maximum is 1) error: ROMX bank 4294967295 does not exist (the maximum is 65535)
at script-oob-bank-num.link(3) at script-oob-bank-num.link(3)
error: WRAM0 bank 1 does not exist (the maximum is 0) error: VRAM bank 2 does not exist (the maximum is 1)
at script-oob-bank-num.link(4) at script-oob-bank-num.link(4)
error: WRAMX bank 0 does not exist (the minimum is 1) error: WRAM0 bank 1 does not exist (the maximum is 0)
at script-oob-bank-num.link(5) at script-oob-bank-num.link(5)
error: WRAMX bank 8 does not exist (the maximum is 7) error: WRAMX bank 0 does not exist (the minimum is 1)
at script-oob-bank-num.link(6) at script-oob-bank-num.link(6)
error: OAM bank 1 does not exist (the maximum is 0) error: WRAMX bank 8 does not exist (the maximum is 7)
at script-oob-bank-num.link(7) at script-oob-bank-num.link(7)
error: HRAM bank 1 does not exist (the maximum is 0) error: OAM bank 1 does not exist (the maximum is 0)
at script-oob-bank-num.link(8) at script-oob-bank-num.link(8)
Linking failed with 8 errors error: HRAM bank 1 does not exist (the maximum is 0)
at script-oob-bank-num.link(9)
Linking failed with 9 errors