aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/shared_memory.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-04-03 11:48:11 -0400
committerGitHub <noreply@github.com>2019-04-03 11:48:11 -0400
commit580e3564c9f2cac47b39fc5c3214271cff0648fb (patch)
tree88175f150482c61d8d53ef7813956455ce4aac5a /src/core/hle/kernel/shared_memory.cpp
parent74a4a5047017f9ed01d7139a1e6aee258382b91d (diff)
parent108be41316cc58c191f525e816d2a33404ab41a0 (diff)
Merge pull request #2305 from lioncash/shared
kernel/shared_memory: Sanitize supplied size when unmapping
Diffstat (limited to 'src/core/hle/kernel/shared_memory.cpp')
-rw-r--r--src/core/hle/kernel/shared_memory.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index 62861da36..f15c5ee36 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -9,7 +9,6 @@
#include "core/hle/kernel/errors.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/shared_memory.h"
-#include "core/memory.h"
namespace Kernel {
@@ -119,7 +118,15 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
ConvertPermissions(permissions));
}
-ResultCode SharedMemory::Unmap(Process& target_process, VAddr address) {
+ResultCode SharedMemory::Unmap(Process& target_process, VAddr address, u64 unmap_size) {
+ if (unmap_size != size) {
+ LOG_ERROR(Kernel,
+ "Invalid size passed to Unmap. Size must be equal to the size of the "
+ "memory managed. Shared memory size=0x{:016X}, Unmap size=0x{:016X}",
+ size, unmap_size);
+ return ERR_INVALID_SIZE;
+ }
+
// TODO(Subv): Verify what happens if the application tries to unmap an address that is not
// mapped to a SharedMemory.
return target_process.VMManager().UnmapRange(address, size);