diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2016-03-07 10:39:59 -0700 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-03-07 11:24:02 -0700 |
| commit | b79741ec66b5496dbd257b59c3d5a6b457f4a5c6 (patch) | |
| tree | a931a58017a22a6fff5016f0fd38821648e6a2df | |
| parent | 607a0a84a2d4034ae543554c0b32b57e4a17923e (diff) | |
| download | usermoji-b79741ec66b5496dbd257b59c3d5a6b457f4a5c6.tar.xz | |
layers: LX413, Fix dynamicOffsets crash in draw_state
Properly handle CmdBindDescriptorSets being called multiple times
consecutively. DynamicOffsets being overwritten on subsequent calls,
resulting in a crash when the array was indexed out-of-bounds.
| -rw-r--r-- | layers/draw_state.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 7f0b962c..40fa5f0e 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -5827,9 +5827,9 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuff skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t) commandBuffer, __LINE__, DRAWSTATE_INVALID_DYNAMIC_OFFSET_COUNT, "DS", "Attempting to bind %u descriptorSets with %u dynamic descriptors, but dynamicOffsetCount is %u. It should exactly match the number of dynamic descriptors.", setCount, totalDynamicDescriptors, dynamicOffsetCount); } - if (dynamicOffsetCount) { - // Save dynamicOffsets bound to this CB - pCB->dynamicOffsets.assign(pDynamicOffsets, pDynamicOffsets + dynamicOffsetCount); + // Save dynamicOffsets bound to this CB + for (uint32_t i = 0; i < dynamicOffsetCount; i++) { + pCB->dynamicOffsets.emplace_back(pDynamicOffsets[i]); } } } else { |
