summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2021-09-19 16:09:43 -0400
committerGitHub <noreply@github.com>2021-09-19 16:09:43 -0400
commitca2589f7df2faaf0628a186ef87c6a413e51381a (patch)
tree95c6c6970fbbaf98b6e454b09218bf4a9104a94c /Source
parent31ca1147210ccb9081a680d8c134f1511cc356d5 (diff)
parentbd92c29ef5a3c664c77a64cdabc5346f4e9383db (diff)
Merge pull request #10103 from AdmiralCurtiss/cheat-search-length-underflow
Core/CheatSearch: Avoid length underflow on new search.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/CheatSearch.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/Core/CheatSearch.cpp b/Source/Core/Core/CheatSearch.cpp
index f83b7f8b9d..1b85cd9d14 100644
--- a/Source/Core/Core/CheatSearch.cpp
+++ b/Source/Core/Core/CheatSearch.cpp
@@ -212,9 +212,16 @@ Cheats::NewSearch(const std::vector<Cheats::MemoryRange>& memory_ranges,
for (const Cheats::MemoryRange& range : memory_ranges)
{
+ if (range.m_length < data_size)
+ continue;
+
const u32 increment_per_loop = aligned ? data_size : 1;
const u32 start_address = aligned ? Common::AlignUp(range.m_start, data_size) : range.m_start;
const u64 aligned_length = range.m_length - (start_address - range.m_start);
+
+ if (aligned_length < data_size)
+ continue;
+
const u64 length = aligned_length - (data_size - 1);
for (u64 i = 0; i < length; i += increment_per_loop)
{