mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Improve (?) handling of invalid addresses in Memset to avoid a crash
This commit is contained in:
1 parent
77d9c769fa
commit
8f262df4fe
1 file changed
+7
-2
+7
-2
@@ -493,8 +493,13 @@ void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength, const char
|
||||
uint8_t *ptr = GetPointerWriteUnchecked(_Address);
|
||||
memset(ptr, _iValue, _iLength);
|
||||
} else {
|
||||
for (size_t i = 0; i < _iLength; i++)
|
||||
Write_U8(_iValue, (u32)(_Address + i));
|
||||
// TODO: This mainly seems to be produced by GPUCommon::PerformMemorySet, called from
|
||||
// Replace_memset_jak(). Strangely, this managed to crash in Write_U8().
|
||||
for (size_t i = 0; i < _iLength; i++) {
|
||||
if (Memory::IsValidAddress(_Address + i)) {
|
||||
WriteUnchecked_U8(_iValue, (u32)(_Address + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tag) {
|
||||
|
||||
Reference in new issue
Block a user