HeapArray: Avoid writing out of bounds in internal_resize

This commit is contained in:
Benjamin Moir 2024-04-25 03:49:54 +10:00 committed by refractionpcsx2
parent 550da21015
commit d48c3cfce5
1 changed files with 1 additions and 1 deletions

View File

@ -362,7 +362,7 @@ private:
if (prev_ptr) if (prev_ptr)
{ {
std::memcpy(m_data, prev_ptr, prev_size * sizeof(T)); std::memcpy(m_data, prev_ptr, std::min(size, prev_size) * sizeof(T));
std::free(prev_ptr); std::free(prev_ptr);
} }
#endif #endif