SaveState: Bounds check FreezeMem loads

This commit is contained in:
TheLastRar 2024-11-27 17:57:42 +00:00 committed by Ty
parent 4ad1355af3
commit 93652a3115
1 changed files with 3 additions and 0 deletions

View File

@ -315,6 +315,9 @@ memLoadingState::memLoadingState(const VmStateBuffer& load_from)
// Loading of state data from a memory buffer... // Loading of state data from a memory buffer...
void memLoadingState::FreezeMem( void* data, int size ) void memLoadingState::FreezeMem( void* data, int size )
{ {
if (m_idx + size > m_memory.size())
m_error = true;
if (m_error) if (m_error)
{ {
std::memset(data, 0, size); std::memset(data, 0, size);