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.
This commit is contained in:
Marvin Scholz 2024-10-09 02:12:39 +02:00 committed by Lynne
parent e6ecc1e757
commit f5e2914a89
1 changed files with 1 additions and 1 deletions

View File

@ -646,7 +646,7 @@ int ff_vk_exec_add_dep_bool_sem(FFVulkanContext *s, FFVkExecContext *e,
return 0; return 0;
} }
buf_size = sizeof(int) + sizeof(VkSemaphore)*nb; buf_size = sizeof(*ts) + sizeof(VkSemaphore)*nb;
ts = av_mallocz(buf_size); ts = av_mallocz(buf_size);
if (!ts) { if (!ts) {
err = AVERROR(ENOMEM); err = AVERROR(ENOMEM);