diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-11 22:39:25 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-18 16:53:47 +0100 |
commit | e696ed1f4d20f28f8b26c637498962938df7d96f (patch) | |
tree | 79222d795725ba7b19f0aa9326041e236f9a22d8 /src/core/hle/kernel/svc.cpp | |
parent | qt/main: Register Qt Software Keyboard frontend with AM (diff) | |
download | yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.gz yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.bz2 yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.lz yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.xz yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.zst yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 20af65ee7..f84b00a00 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1207,14 +1207,15 @@ static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 return ERR_INVALID_ADDRESS; } - if (addr + size <= addr) { + if (!IsValidAddressRange(addr, size)) { LOG_ERROR(Kernel_SVC, "Address and size cause overflow! (address={:016X}, size={:016X})", addr, size); return ERR_INVALID_ADDRESS_STATE; } - if (permissions > static_cast<u32>(MemoryPermission::ReadWrite) || - permissions == static_cast<u32>(MemoryPermission::Write)) { + const auto perms = static_cast<MemoryPermission>(permissions); + if (perms != MemoryPermission::None && perms != MemoryPermission::Read && + perms != MemoryPermission::ReadWrite) { LOG_ERROR(Kernel_SVC, "Invalid memory permissions for transfer memory! (perms={:08X})", permissions); return ERR_INVALID_MEMORY_PERMISSIONS; @@ -1222,7 +1223,6 @@ static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 auto& kernel = Core::System::GetInstance().Kernel(); auto& handle_table = Core::CurrentProcess()->GetHandleTable(); - const auto perms = static_cast<MemoryPermission>(permissions); const auto shared_mem_handle = SharedMemory::Create( kernel, handle_table.Get<Process>(CurrentProcess), size, perms, perms, addr); |