mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Check for bad indices in GetReplacementFunc to avoid crashes
This commit is contained in:
parent
6a8f65b566
commit
8fc01e37d9
@ -1590,7 +1590,10 @@ std::vector<int> GetReplacementFuncIndexes(u64 hash, int funcSize) {
|
||||
return emptyResult;
|
||||
}
|
||||
|
||||
const ReplacementTableEntry *GetReplacementFunc(int i) {
|
||||
const ReplacementTableEntry *GetReplacementFunc(size_t i) {
|
||||
if (i >= ARRAY_SIZE(entries)) {
|
||||
return nullptr;
|
||||
}
|
||||
return &entries[i];
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ void Replacement_Shutdown();
|
||||
|
||||
int GetNumReplacementFuncs();
|
||||
std::vector<int> GetReplacementFuncIndexes(u64 hash, int funcSize);
|
||||
const ReplacementTableEntry *GetReplacementFunc(int index);
|
||||
const ReplacementTableEntry *GetReplacementFunc(size_t index);
|
||||
|
||||
void WriteReplaceInstructions(u32 address, u64 hash, int size);
|
||||
void RestoreReplacedInstruction(u32 address);
|
||||
|
@ -563,6 +563,7 @@ void Arm64Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
const ReplacementTableEntry *entry = GetReplacementFunc(index);
|
||||
if (!entry) {
|
||||
ERROR_LOG(HLE, "Invalid replacement op %08x", op.encoding);
|
||||
// TODO: What should we do here? We're way off in the weeds probably.
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user