summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-06 05:20:23 +0200
committerGitHub <noreply@github.com>2020-08-06 05:20:23 +0200
commit1cc0e4b4d81af64217cb488375af97dfbc8f984f (patch)
tree95e55d849d7aaa210f4ad2835c0a45f0a6a7999a /src/core
parentMerge pull request #4484 from lioncash/aesutil (diff)
parentipc_helpers: Only allow trivially copyable objects with PushRaw() and PopRaw() (diff)
downloadyuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.tar
yuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.tar.gz
yuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.tar.bz2
yuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.tar.lz
yuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.tar.xz
yuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.tar.zst
yuzu-1cc0e4b4d81af64217cb488375af97dfbc8f984f.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/ipc_helpers.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 0dc6a4a43..1b503331f 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -229,6 +229,8 @@ inline void ResponseBuilder::Push(u32 value) {
template <typename T>
void ResponseBuilder::PushRaw(const T& value) {
+ static_assert(std::is_trivially_copyable_v<T>,
+ "It's undefined behavior to use memcpy with non-trivially copyable objects");
std::memcpy(cmdbuf + index, &value, sizeof(T));
index += (sizeof(T) + 3) / 4; // round up to word length
}
@@ -384,6 +386,8 @@ inline s32 RequestParser::Pop() {
template <typename T>
void RequestParser::PopRaw(T& value) {
+ static_assert(std::is_trivially_copyable_v<T>,
+ "It's undefined behavior to use memcpy with non-trivially copyable objects");
std::memcpy(&value, cmdbuf + index, sizeof(T));
index += (sizeof(T) + 3) / 4; // round up to word length
}