Skip to content

Commit

Permalink
Make vm::_test_map aware of overflow
Browse files Browse the repository at this point in the history
+ remove vm::find_map 1024mb limit.
  • Loading branch information
elad335 committed Apr 4, 2020
1 parent 63080c2 commit 285c48e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions rpcs3/Emu/Memory/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Utilities/cond.h"
#include "Utilities/Thread.h"
#include "Utilities/VirtualMemory.h"
#include "Utilities/address_range.h"
#include "Utilities/asm.h"
#include "Emu/CPU/CPUThread.h"
#include "Emu/Cell/lv2/sys_memory.h"
Expand Down Expand Up @@ -888,14 +889,21 @@ namespace vm

static bool _test_map(u32 addr, u32 size)
{
const auto range = utils::address_range::start_length(addr, size);

if (!range.valid())
{
return false;
}

for (auto& block : g_locations)
{
if (block && block->addr >= addr && block->addr <= addr + size - 1)
if (!block)
{
return false;
continue;
}

if (block && addr >= block->addr && addr <= block->addr + block->size - 1)
if (range.overlaps(utils::address_range::start_length(block->addr, block->size)))
{
return false;
}
Expand Down Expand Up @@ -990,7 +998,7 @@ namespace vm
}

// Return if size is invalid
if (!size || size > 0x40000000)
if (!size)
{
return nullptr;
}
Expand Down

0 comments on commit 285c48e

Please sign in to comment.