mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Cheats: Clamp pointer command data to avail.
In case more data is provided, as was allowed before.
This commit is contained in:
parent
0ed62cfe30
commit
baf351c372
1 changed files with 4 additions and 4 deletions
|
@ -495,11 +495,11 @@ CheatOperation CWCheatEngine::InterpretNextCwCheat(const CheatCode &cheat, size_
|
|||
addr = GetAddress(line1.part1 & 0x0FFFFFFF);
|
||||
if (i < cheat.lines.size()) {
|
||||
const CheatLine &line2 = cheat.lines[i++];
|
||||
const int count = line2.part1 & 0xFFFF;
|
||||
int count = line2.part1 & 0xFFFF;
|
||||
|
||||
// Doesn't have enough lines to process.
|
||||
if (i - 1 + count > cheat.lines.size())
|
||||
return { CheatOp::Invalid };
|
||||
// Clamp lines to process - previously allowed invalid counts.
|
||||
if (i + count > cheat.lines.size())
|
||||
count = cheat.lines.size() - i;
|
||||
|
||||
CheatOperation op = { CheatOp::CwCheatPointerCommands, addr, 0, arg };
|
||||
op.pointerCommands.offset = (int)line2.part2;
|
||||
|
|
Loading…
Add table
Reference in a new issue