mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 13:19:00 +00:00
Return EINVAL if mmap is called with length 0 (#3496)
Hit by some multimedia apps
This commit is contained in:
@@ -575,6 +575,12 @@ void* PS4_SYSV_ABI posix_mmap(void* addr, u64 len, s32 prot, s32 flags, s32 fd,
|
|||||||
"called addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, fd = {}, phys_addr = {:#x}",
|
"called addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, fd = {}, phys_addr = {:#x}",
|
||||||
fmt::ptr(addr), len, prot, flags, fd, phys_addr);
|
fmt::ptr(addr), len, prot, flags, fd, phys_addr);
|
||||||
|
|
||||||
|
if (len == 0) {
|
||||||
|
// If length is 0, mmap returns EINVAL.
|
||||||
|
ErrSceToPosix(ORBIS_KERNEL_ERROR_EINVAL);
|
||||||
|
return reinterpret_cast<void*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
void* addr_out;
|
void* addr_out;
|
||||||
auto* memory = Core::Memory::Instance();
|
auto* memory = Core::Memory::Instance();
|
||||||
const auto mem_prot = static_cast<Core::MemoryProt>(prot);
|
const auto mem_prot = static_cast<Core::MemoryProt>(prot);
|
||||||
|
|||||||
Reference in New Issue
Block a user