From 19330f45d3d0efbf490a436c8689f30c4fc79e44 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 9 Mar 2019 14:36:52 -0500 Subject: [PATCH] maxwell_dma: Check for valid source in destination before copy. - Avoid a crash in Octopath Traveler. --- src/video_core/engines/maxwell_dma.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index a0ded4c25..5cca5c29a 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp @@ -88,6 +88,16 @@ void MaxwellDMA::HandleCopy() { auto source_ptr{memory_manager.GetPointer(source)}; auto dst_ptr{memory_manager.GetPointer(dest)}; + if (!source_ptr) { + LOG_ERROR(HW_GPU, "source_ptr is invalid"); + return; + } + + if (!dst_ptr) { + LOG_ERROR(HW_GPU, "dst_ptr is invalid"); + return; + } + const auto FlushAndInvalidate = [&](u32 src_size, u64 dst_size) { // TODO(Subv): For now, manually flush the regions until we implement GPU-accelerated // copying.