Return EINVAL if mmap is called with length 0 (#3496)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

Hit by some multimedia apps
This commit is contained in:
Stephen Miller 2025-08-31 18:14:51 -05:00 committed by GitHub
parent be8c35eef1
commit bcea7a02c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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}",
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;
auto* memory = Core::Memory::Instance();
const auto mem_prot = static_cast<Core::MemoryProt>(prot);