mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-10-30 08:02:11 +00:00
Fix out of bounds error when scanning jump tables if the end of the binary is encountered
This commit is contained in:
parent
6860826da3
commit
950f9f5e15
1 changed files with 6 additions and 0 deletions
|
|
@ -321,7 +321,13 @@ bool N64Recomp::analyze_function(const N64Recomp::Context& context, const N64Rec
|
||||||
while (vram < end_address) {
|
while (vram < end_address) {
|
||||||
// Retrieve the current entry of the jump table
|
// Retrieve the current entry of the jump table
|
||||||
// TODO same as above
|
// TODO same as above
|
||||||
|
|
||||||
|
// Stop scanning if the end of the ROM is reached.
|
||||||
uint32_t rom_addr = vram + func.rom - func.vram;
|
uint32_t rom_addr = vram + func.rom - func.vram;
|
||||||
|
if (rom_addr >= context.rom.size()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t jtbl_word = byteswap(*reinterpret_cast<const uint32_t*>(&context.rom[rom_addr]));
|
uint32_t jtbl_word = byteswap(*reinterpret_cast<const uint32_t*>(&context.rom[rom_addr]));
|
||||||
|
|
||||||
if (cur_jtbl.got_offset.has_value() && got_ram_addr.has_value()) {
|
if (cur_jtbl.got_offset.has_value() && got_ram_addr.has_value()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue