layers: Fix state tracking for vkFlushMappedMemoryRanges()
authorTobin Ehlis <tobine@google.com>
Wed, 5 Oct 2016 13:50:25 +0000 (07:50 -0600)
committerTobin Ehlis <tobine@google.com>
Wed, 5 Oct 2016 20:56:01 +0000 (14:56 -0600)
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.

layers/core_validation.cpp

index 112a7b5..d89daab 100644 (file)
@@ -10872,7 +10872,7 @@ static bool ValidateAndCopyNoncoherentMemoryToDriver(layer_data *dev_data, uint3
             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) {