Prevent some stack overflows in MMIO handler.

This commit is contained in:
Ben Vanik 2015-05-09 00:53:28 -07:00
parent ca2beb4f65
commit 0c646f4bc2
1 changed files with 5 additions and 0 deletions

View File

@ -185,6 +185,11 @@ bool MMIOHandler::CheckWriteWatch(void* thread_state, uint64_t fault_address) {
bool MMIOHandler::HandleAccessFault(void* thread_state, bool MMIOHandler::HandleAccessFault(void* thread_state,
uint64_t fault_address) { 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. // Access violations are pretty rare, so we can do a linear search here.
const MMIORange* range = nullptr; const MMIORange* range = nullptr;
for (const auto& test_range : mapped_ranges_) { for (const auto& test_range : mapped_ranges_) {