Explorar el Código

Memory Manager: ensure safety of GPU to CPU address.

Fernando Sahmkow hace 4 años
padre
commit
7cfa28a666
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      src/video_core/memory_manager.cpp

+ 3 - 0
src/video_core/memory_manager.cpp

@@ -193,6 +193,9 @@ void MemoryManager::Unmap(GPUVAddr gpu_addr, std::size_t size) {
 }
 
 std::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) const {
+    if (gpu_addr >= address_space_size) [[unlikely]] {
+        return std::nullopt;
+    }
     if (GetEntry<true>(gpu_addr) != EntryType::Mapped) [[unlikely]] {
         if (GetEntry<false>(gpu_addr) != EntryType::Mapped) {
             return std::nullopt;