Add sanity check in Memory::Memset

This commit is contained in:
Henrik Rydgård 2017-11-30 16:49:14 +01:00
parent b6f69b71ab
commit 20e93515be

View File

@ -438,14 +438,11 @@ void Write_Opcode_JIT(const u32 _Address, const Opcode& _Value)
Memory::WriteUnchecked_U32(_Value.encoding, _Address);
}
void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
{
void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) {
u8 *ptr = GetPointer(_Address);
if (ptr != NULL) {
if (ptr && IsValidAddress(_Address + _iLength - 1)) {
memset(ptr, _iValue, _iLength);
}
else
{
} else {
for (size_t i = 0; i < _iLength; i++)
Write_U8(_iValue, (u32)(_Address + i));
}