fix out-of-bound access in sram (#95)
This commit is contained in:
parent
a40e795036
commit
0eadc38917
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user