removed variable-sized array (#23102)
This is undefined behavior. I've replaced it with std::vector instead
Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc
index b4e0071..e2d45bb 100644
--- a/vulkan/vulkan_device.cc
+++ b/vulkan/vulkan_device.cc
@@ -288,9 +288,11 @@
return -1;
}
- VkSurfaceFormatKHR formats[format_count];
+ std::vector<VkSurfaceFormatKHR> formats;
+ formats.resize(format_count);
+
if (VK_CALL_LOG_ERROR(vk.GetPhysicalDeviceSurfaceFormatsKHR(
- physical_device_, surface.Handle(), &format_count, formats)) !=
+ physical_device_, surface.Handle(), &format_count, formats.data())) !=
VK_SUCCESS) {
return -1;
}