From 0c646f4bc2945b0593cd5c338d174bf2ef24ae91 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 9 May 2015 00:53:28 -0700 Subject: [PATCH] Prevent some stack overflows in MMIO handler. --- src/xenia/cpu/mmio_handler.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xenia/cpu/mmio_handler.cc b/src/xenia/cpu/mmio_handler.cc index c9f17eaca..b9e58fff6 100644 --- a/src/xenia/cpu/mmio_handler.cc +++ b/src/xenia/cpu/mmio_handler.cc @@ -185,6 +185,11 @@ bool MMIOHandler::CheckWriteWatch(void* thread_state, uint64_t fault_address) { bool MMIOHandler::HandleAccessFault(void* thread_state, uint64_t fault_address) { + if (fault_address < uint64_t(mapping_base_)) { + // Quick kill anything below our mapping base. + return false; + } + // Access violations are pretty rare, so we can do a linear search here. const MMIORange* range = nullptr; for (const auto& test_range : mapped_ranges_) {