From 2d809abbb38af2d11ed9b622bbce1b7e598c7c77 Mon Sep 17 00:00:00 2001 From: Basit Ayantunde Date: Thu, 14 Jan 2021 14:33:29 -0800 Subject: [PATCH] removed variable-sized array (flutter/engine#23102) This is undefined behavior. I've replaced it with std::vector instead Co-authored-by: Zachary Anderson --- engine/src/flutter/vulkan/vulkan_device.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/vulkan/vulkan_device.cc b/engine/src/flutter/vulkan/vulkan_device.cc index b4e0071b7e6..e2d45bb5e1f 100644 --- a/engine/src/flutter/vulkan/vulkan_device.cc +++ b/engine/src/flutter/vulkan/vulkan_device.cc @@ -288,9 +288,11 @@ int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface, return -1; } - VkSurfaceFormatKHR formats[format_count]; + std::vector 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; }