Permalink
Browse files

Add sanity check in Memory::Memset

  • Loading branch information...
hrydgard committed Nov 30, 2017
1 parent b6f69b7 commit 20e93515be8cd9bb8abc582dffcd249dfade3598
Showing with 3 additions and 6 deletions.
  1. +3 −6 Core/MemMap.cpp
View
@@ -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));
}

0 comments on commit 20e9351

Please sign in to comment.