From 2e3735b7725c51261a390d335e113468d5408ac7 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 27 Nov 2015 17:13:47 +0100 Subject: [PATCH] Memmap: More error checking for Memset It now uses the same error checking as CopyFromEmu and CopyToEmu. --- Source/Core/Core/HW/Memmap.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index 2255d2cb16..e4012095d9 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -282,9 +282,12 @@ void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) if (_iLength == 0) return; - u8* ptr = GetPointer(_Address); - if (ptr != nullptr) - memset(ptr, _iValue, _iLength); + if (!ValidCopyRange(_Address, _iLength)) + { + PanicAlert("Invalid range in Memset. %zx bytes at 0x%08x", _iLength, _Address); + return; + } + memset(GetPointer(_Address), _iValue, _iLength); } std::string GetString(u32 em_address, size_t size)