VERY experimental Nintendo Switch 2 emulator
C++
nvhost_gpu: Added checks to ensure we don't read past the end of the entries when handling a GPU command list.
Subv253cd9b5b9d8
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cppindex 126782573a..5a1123ad26 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp@@ -132,9 +132,12 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outpLOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}",params.address, params.num_entries, params.flags);- auto entries = std::vector<IoctlGpfifoEntry>();- entries.resize(params.num_entries);- std::memcpy(&entries[0], &input.data()[sizeof(IoctlSubmitGpfifo)],+ ASSERT_MSG(input.size() ==+ sizeof(IoctlSubmitGpfifo) + params.num_entries * sizeof(IoctlGpfifoEntry),+ "Incorrect input size");++ std::vector<IoctlGpfifoEntry> entries(params.num_entries);+ std::memcpy(entries.data(), &input[sizeof(IoctlSubmitGpfifo)],params.num_entries * sizeof(IoctlGpfifoEntry));for (auto entry : entries) {Tegra::GPUVAddr va_addr = entry.Address();