diff options
| author | 2023-07-24 13:47:11 -0400 | |
|---|---|---|
| committer | 2023-07-24 13:47:11 -0400 | |
| commit | 18000df5e968af0aa9784f398a97da2733262126 (patch) | |
| tree | 731480485f1d42ebc9945ce42351dd5340a4f889 /src/core/debugger/gdbstub.cpp | |
| parent | Merge pull request #11135 from liamwhite/getaddrinfo (diff) | |
| parent | core: reduce TOCTTOU memory access (diff) | |
| download | yuzu-18000df5e968af0aa9784f398a97da2733262126.tar.gz yuzu-18000df5e968af0aa9784f398a97da2733262126.tar.xz yuzu-18000df5e968af0aa9784f398a97da2733262126.zip | |
Merge pull request #11095 from liamwhite/memory2
memory: cleanup
Diffstat (limited to 'src/core/debugger/gdbstub.cpp')
| -rw-r--r-- | src/core/debugger/gdbstub.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index da6078372..0f839d5b4 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp | |||
| @@ -261,10 +261,8 @@ void GDBStub::ExecuteCommand(std::string_view packet, std::vector<DebuggerAction | |||
| 261 | const size_t addr{static_cast<size_t>(strtoll(command.data(), nullptr, 16))}; | 261 | const size_t addr{static_cast<size_t>(strtoll(command.data(), nullptr, 16))}; |
| 262 | const size_t size{static_cast<size_t>(strtoll(command.data() + sep, nullptr, 16))}; | 262 | const size_t size{static_cast<size_t>(strtoll(command.data() + sep, nullptr, 16))}; |
| 263 | 263 | ||
| 264 | if (system.ApplicationMemory().IsValidVirtualAddressRange(addr, size)) { | 264 | std::vector<u8> mem(size); |
| 265 | std::vector<u8> mem(size); | 265 | if (system.ApplicationMemory().ReadBlock(addr, mem.data(), size)) { |
| 266 | system.ApplicationMemory().ReadBlock(addr, mem.data(), size); | ||
| 267 | |||
| 268 | SendReply(Common::HexToString(mem)); | 266 | SendReply(Common::HexToString(mem)); |
| 269 | } else { | 267 | } else { |
| 270 | SendReply(GDB_STUB_REPLY_ERR); | 268 | SendReply(GDB_STUB_REPLY_ERR); |
| @@ -281,8 +279,7 @@ void GDBStub::ExecuteCommand(std::string_view packet, std::vector<DebuggerAction | |||
| 281 | const auto mem_substr{std::string_view(command).substr(mem_sep)}; | 279 | const auto mem_substr{std::string_view(command).substr(mem_sep)}; |
| 282 | const auto mem{Common::HexStringToVector(mem_substr, false)}; | 280 | const auto mem{Common::HexStringToVector(mem_substr, false)}; |
| 283 | 281 | ||
| 284 | if (system.ApplicationMemory().IsValidVirtualAddressRange(addr, size)) { | 282 | if (system.ApplicationMemory().WriteBlock(addr, mem.data(), size)) { |
| 285 | system.ApplicationMemory().WriteBlock(addr, mem.data(), size); | ||
| 286 | system.InvalidateCpuInstructionCacheRange(addr, size); | 283 | system.InvalidateCpuInstructionCacheRange(addr, size); |
| 287 | SendReply(GDB_STUB_REPLY_OK); | 284 | SendReply(GDB_STUB_REPLY_OK); |
| 288 | } else { | 285 | } else { |