Checks for underflow and overflow when flushing mapped memory where using the
flush offset instead of the original mapped region offset to determine size of
total mapped region.
if (mem_info->shadow_copy) {
VkDeviceSize size = (mem_info->mem_range.size != VK_WHOLE_SIZE)
? mem_info->mem_range.size
- : (mem_info->alloc_info.allocationSize - pMemRanges[i].offset);
+ : (mem_info->alloc_info.allocationSize - mem_info->mem_range.offset);
char *data = static_cast<char *>(mem_info->shadow_copy);
for (uint64_t j = 0; j < mem_info->shadow_pad_size; ++j) {
if (data[j] != NoncoherentMemoryFillValue) {