Skip to content

Commit

Permalink
[core] memory: Fix unaligned S16 reads from out-of-bounds ROM.
Browse files Browse the repository at this point in the history
  • Loading branch information
fleroviux committed May 24, 2020
1 parent 8d5fcd8 commit 65c857a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/emulator/core/cpu-memory.inl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ inline auto CPU::ReadByte(std::uint32_t address, Access access) -> std::uint8_t
// return gpio->read(address);
// }
if (address >= memory.rom.size) {
return address / 2;
return (address / 2) >> ((address & 1) * 8);
}
return Read<std::uint8_t>(memory.rom.data.get(), address);
}
Expand Down

0 comments on commit 65c857a

Please sign in to comment.