Clamp masked writes to mapped memory region against size. Closes #2268

* When manually masking writes to mapped memory with tiled resources we need to
  avoid overrunning the bounds of the mapped region.
This commit is contained in:
baldurk
2021-05-04 12:21:51 +01:00
parent 3d2c003348
commit c7b7d3dbcc
@@ -1103,6 +1103,9 @@ bool WrappedVulkan::Serialise_vkFlushMappedMemoryRanges(SerialiserType &ser, VkD
// *sooner*.
size_t size = size_t(RDCMIN(it->finish(), finish) - offs);
// cap the size by the mapped memory region
size = RDCMIN(MemRange.size, size);
memcpy(MappedData + offs, m_MaskedMapData.data() + offs, size);
}