Merge pull request #7506 from elad335/patch-1

PPU exec/ovlm ldr: restrict allocations
This commit is contained in:
Ivan 2020-02-27 22:55:30 +03:00 committed by GitHub
commit e133c7a7dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1085,7 +1085,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
if (prog.bin.size() > size || prog.bin.size() != prog.p_filesz)
fmt::throw_exception("Invalid binary size (0x%llx, memsz=0x%x)", prog.bin.size(), size);
if (!vm::falloc(addr, size))
if (!vm::falloc(addr, size, vm::main))
fmt::throw_exception("vm::falloc() failed (addr=0x%x, memsz=0x%x)", addr, size);
// Copy segment data, hash it
@ -1655,7 +1655,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
if (prog.bin.size() > size || prog.bin.size() != prog.p_filesz)
fmt::throw_exception("Invalid binary size (0x%llx, memsz=0x%x)", prog.bin.size(), size);
if (!vm::falloc(addr, size))
if (!vm::get(vm::any, 0x30000000)->falloc(addr, size))
fmt::throw_exception("vm::falloc() failed (addr=0x%x, memsz=0x%x)", addr, size);
// Copy segment data, hash it