From f5e2914a89c2d1c38d3ac80ae43c0eda743892f3 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Wed, 9 Oct 2024 02:12:39 +0200 Subject: [PATCH] libavutil/vulkan: fix flexible array struct allocation The flexible array member struct can have padding added by the compiler which was not taken into account properly, which could lead to a heap buffer overflow. --- libavutil/vulkan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 7ad938b047..4a194ff082 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -646,7 +646,7 @@ int ff_vk_exec_add_dep_bool_sem(FFVulkanContext *s, FFVkExecContext *e, return 0; } - buf_size = sizeof(int) + sizeof(VkSemaphore)*nb; + buf_size = sizeof(*ts) + sizeof(VkSemaphore)*nb; ts = av_mallocz(buf_size); if (!ts) { err = AVERROR(ENOMEM);