PR #21781 opened by lompik URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21781 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21781.patch
This fixes a SIGSEGV happening (for >1 plane images) in drivers as we are sending a null semaphore for them to wait on. for example: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20057 >From 38cd91c99a626ef12ba46e34be7a8308c9e84085 Mon Sep 17 00:00:00 2001 From: lompik <[email protected]> Date: Wed, 18 Feb 2026 13:48:04 +0400 Subject: [PATCH] hwdec/vulkan: fix invalid number of planes usage in map_to_drm This fixes a SIGSEGV happening (for >1 plane images) in drivers as we are sending a null semaphore for them to wait on. --- libavutil/hwcontext_vulkan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 123ae4363c..3bcf5d732f 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -4153,14 +4153,14 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; VulkanFramesPriv *fp = hwfc->hwctx; - const int planes = av_pix_fmt_count_planes(hwfc->sw_format); + const int nb_images = ff_vk_count_images(f); VkImageDrmFormatModifierPropertiesEXT drm_mod = { .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT, }; VkSemaphoreWaitInfo wait_info = { .sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, .flags = 0x0, - .semaphoreCount = planes, + .semaphoreCount = nb_images, }; AVDRMFrameDescriptor *drm_desc = av_mallocz(sizeof(*drm_desc)); @@ -4189,7 +4189,7 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, goto end; } - for (int i = 0; (i < planes) && (f->mem[i]); i++) { + for (int i = 0; (i < nb_images) && (f->mem[i]); i++) { VkMemoryGetFdInfoKHR export_info = { .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR, .memory = f->mem[i], @@ -4209,7 +4209,7 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, drm_desc->objects[i].format_modifier = drm_mod.drmFormatModifier; } - drm_desc->nb_layers = planes; + drm_desc->nb_layers = nb_images; for (int i = 0; i < drm_desc->nb_layers; i++) { VkFormat plane_vkfmt = av_vkfmt_from_pixfmt(hwfc->sw_format)[i]; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
