summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-02-17 19:54:59 +0100
committerSubv <subv2112@gmail.com>2018-02-17 20:00:44 +0100
commitd7583324259c0c99d9f4a545751dc109229c6f05 (patch)
tree4e5c31ad1e22a357b21a0b14441f48d9ea8b7144
parentVi: Mark all fences as NO_FENCE in the DequeueBuffer response parcel. (diff)
downloadyuzu-d7583324259c0c99d9f4a545751dc109229c6f05.tar
yuzu-d7583324259c0c99d9f4a545751dc109229c6f05.tar.gz
yuzu-d7583324259c0c99d9f4a545751dc109229c6f05.tar.bz2
yuzu-d7583324259c0c99d9f4a545751dc109229c6f05.tar.lz
yuzu-d7583324259c0c99d9f4a545751dc109229c6f05.tar.xz
yuzu-d7583324259c0c99d9f4a545751dc109229c6f05.tar.zst
yuzu-d7583324259c0c99d9f4a545751dc109229c6f05.zip
-rw-r--r--src/core/hle/service/vi/vi.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 1afd5a4fb..0aa621dfe 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -39,6 +39,7 @@ public:
template <typename T>
T Read() {
+ ASSERT(read_index + sizeof(T) <= buffer.size());
T val;
std::memcpy(&val, buffer.data() + read_index, sizeof(T));
read_index += sizeof(T);
@@ -48,6 +49,7 @@ public:
template <typename T>
T ReadUnaligned() {
+ ASSERT(read_index + sizeof(T) <= buffer.size());
T val;
std::memcpy(&val, buffer.data() + read_index, sizeof(T));
read_index += sizeof(T);
@@ -55,6 +57,7 @@ public:
}
std::vector<u8> ReadBlock(size_t length) {
+ ASSERT(read_index + length <= buffer.size());
const u8* const begin = buffer.data() + read_index;
const u8* const end = begin + length;
std::vector<u8> data(begin, end);
@@ -97,6 +100,8 @@ public:
}
void Deserialize() {
+ ASSERT(buffer.size() > sizeof(Header));
+
Header header{};
std::memcpy(&header, buffer.data(), sizeof(Header));