[FFmpeg-devel] [PATCH 2/3] avcodec/vulkan_decode: check specVersion to avoid using incompatible implementations
Kacper Michajłow
kasper93 at gmail.com
Wed Aug 23 23:05:59 EEST 2023
Fixes:
VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190
VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191
As a bonus avoids crashing AMD video driver on Windows, which currently
doesn't advertise support.
Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>
---
libavcodec/vulkan_decode.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 04350578f9..7607edf52e 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -881,6 +881,11 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR ?
" separate_references" : "");
+ if (dec_ext[avctx->codec_id]->specVersion > caps->stdHeaderVersion.specVersion ||
+ strncmp(caps->stdHeaderVersion.extensionName,
+ dec_ext[avctx->codec_id]->extensionName, VK_MAX_EXTENSION_NAME_SIZE))
+ return AVERROR(EINVAL);
+
/* Check if decoding is possible with the given parameters */
if (avctx->width < caps->minCodedExtent.width ||
avctx->height < caps->minCodedExtent.height ||
--
2.34.1
More information about the ffmpeg-devel
mailing list