[FFmpeg-cvslog] libavutil/vulkan: fix flexible array struct allocation

Marvin Scholz git at videolan.org
Wed Oct 9 03:40:09 EEST 2024


ffmpeg | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Oct  9 02:12:39 2024 +0200| [f5e2914a89c2d1c38d3ac80ae43c0eda743892f3] | committer: Lynne

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5e2914a89c2d1c38d3ac80ae43c0eda743892f3
---

 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);



More information about the ffmpeg-cvslog mailing list