fix out-of-bound access in sram (#95)

This commit is contained in:
Logan McNaughton 2024-12-23 11:20:09 +01:00 committed by GitHub
parent a40e795036
commit 0eadc38917
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,7 +141,7 @@ pub fn dma_read_sram(
format_sram(device);
while i < dram_addr + length {
while i < dram_addr + length && i < device::rdram::RDRAM_SIZE as u32 {
device.ui.saves.sram.0[j as usize] = device.rdram.mem[i as usize ^ device.byte_swap];
i += 1;
j += 1;
@ -191,7 +191,7 @@ pub fn dma_write_sram(
format_sram(device);
while i < dram_addr + length {
while i < dram_addr + length && i < device::rdram::RDRAM_SIZE as u32 {
device.rdram.mem[i as usize ^ device.byte_swap] = device.ui.saves.sram.0[j as usize];
i += 1;
j += 1;