summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/NANDContentLoader.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-01-07 00:48:40 +0100
committerPierre Bourdon <delroth@gmail.com>2016-01-07 00:48:40 +0100
commitbff79df3637f7eee1ec267aacbd86413f76c6b5d (patch)
tree335f544ac179aabd6875d55c69557a1145392e70 /Source/Core/DiscIO/NANDContentLoader.cpp
parente668fd7a02ade8c50b6adf37520d596af9c94e98 (diff)
parentba794272f5f6b5a07537ecfacb414c71fdc46b0e (diff)
Merge pull request #3429 from sepalani/debug_vector_fix
Debug Builds: Fixed vector assertion
Diffstat (limited to 'Source/Core/DiscIO/NANDContentLoader.cpp')
-rw-r--r--Source/Core/DiscIO/NANDContentLoader.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp
index 870cd957fb..e2bfe425c7 100644
--- a/Source/Core/DiscIO/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/NANDContentLoader.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <mbedtls/aes.h>
+#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/MathUtil.h"
@@ -190,8 +191,14 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& tmd, co
content.m_Index = Common::swap16(&tmd[entry_offset + 0x01E8]);
content.m_Type = Common::swap16(&tmd[entry_offset + 0x01EA]);
content.m_Size = static_cast<u32>(Common::swap64(&tmd[entry_offset + 0x01EC]));
- std::copy(&tmd[entry_offset + 0x01E4], &tmd[entry_offset + 0x01E4 + 36], content.m_Header);
- std::copy(&tmd[entry_offset + 0x01F4], &tmd[entry_offset + 0x01F4 + 20], content.m_SHA1Hash);
+
+ const auto header_begin = std::next(tmd.begin(), entry_offset + 0x01E4);
+ const auto header_end = std::next(header_begin, ArraySize(content.m_Header));
+ std::copy(header_begin, header_end, content.m_Header);
+
+ const auto hash_begin = std::next(tmd.begin(), entry_offset + 0x01F4);
+ const auto hash_end = std::next(hash_begin, ArraySize(content.m_SHA1Hash));
+ std::copy(hash_begin, hash_end, content.m_SHA1Hash);
if (m_isWAD)
{