HW: Remove calls to GetPointer
Typically when someone uses GetPointer, it's because they want to read from a range of memory. GetPointer is unsafe to use for this. While it does check that the passed-in address is valid, it doesn't know the size of the range that will be accessed, so it can't check that the end address is valid. The safer alternative GetPointerForRange should be used instead. Note that there is still the problem of many callers not checking for nullptr. This is part 2 of a series of changes removing the use of GetPointer throughout the code base. After this, VideoCommon is the one major part of Dolphin that remains.
This commit is contained in:
1 parent
a5e410df11
commit
ad43b03253
11 files changed
+36
-40
No files matched your search
@@ -831,7 +831,7 @@ static void ReadMemory(const Core::CPUThreadGuard& guard)
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
u8* data = memory.GetPointer(addr);
|
||||
u8* data = memory.GetPointerForRange(addr, len);
|
||||
Mem2hex(reply, data, len);
|
||||
reply[len * 2] = '\0';
|
||||
SendReply((char*)reply);
|
||||
@@ -858,7 +858,7 @@ static void WriteMemory(const Core::CPUThreadGuard& guard)
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
u8* dst = memory.GetPointer(addr);
|
||||
u8* dst = memory.GetPointerForRange(addr, len);
|
||||
Hex2mem(dst, s_cmd_bfr + i + 1, len);
|
||||
SendReply("OK");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user