aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2023-06-22 04:59:40 +0200
committerLynne <dev@lynne.ee>2023-06-22 18:18:53 +0200
commit997d8a7e73a9b9f00e4bc32ed3b41b30d2e39cf8 (patch)
tree9968c21663ee1189a66b38fd0d09d041fc22cbf5
parent4ff303a7b827de2179c6e346959e36960e57b5ba (diff)
downloadffmpeg-997d8a7e73a9b9f00e4bc32ed3b41b30d2e39cf8.tar.gz
vulkan_decode: reject decoding of frames with no slices
As per the spec: VUID-VkVideoDecodeH264PictureInfoKHR-sliceCount-arraylength sliceCount must be greater than 0 VUID-VkVideoDecodeH265PictureInfoKHR-sliceSegmentCount-arraylength sliceSegmentCount must be greater than 0 This particularly happens with seeking in field-coded H264.
-rw-r--r--libavcodec/vulkan_av1.c3
-rw-r--r--libavcodec/vulkan_h264.c3
-rw-r--r--libavcodec/vulkan_hevc.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
index e953096b89..e06457bbc3 100644
--- a/libavcodec/vulkan_av1.c
+++ b/libavcodec/vulkan_av1.c
@@ -535,6 +535,9 @@ static int vk_av1_end_frame(AVCodecContext *avctx)
FFVulkanDecodePicture *rvp[AV1_NUM_REF_FRAMES] = { 0 };
AVFrame *rav[AV1_NUM_REF_FRAMES] = { 0 };
+ if (!ap->tile_list.nb_tiles)
+ return 0;
+
if (!dec->session_params) {
int err = vk_av1_create_params(avctx, &dec->session_params);
if (err < 0)
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index 62e350266a..089a181bb4 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -517,6 +517,9 @@ static int vk_h264_end_frame(AVCodecContext *avctx)
FFVulkanDecodePicture *rvp[H264_MAX_PICTURE_COUNT] = { 0 };
AVFrame *rav[H264_MAX_PICTURE_COUNT] = { 0 };
+ if (!hp->h264_pic_info.sliceCount)
+ return 0;
+
if (!dec->session_params) {
int err = vk_h264_create_params(avctx, &dec->session_params);
if (err < 0)
diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
index 5894086821..af5da3984b 100644
--- a/libavcodec/vulkan_hevc.c
+++ b/libavcodec/vulkan_hevc.c
@@ -901,6 +901,9 @@ static int vk_hevc_end_frame(AVCodecContext *avctx)
FFVulkanDecodePicture *rvp[HEVC_MAX_REFS] = { 0 };
AVFrame *rav[HEVC_MAX_REFS] = { 0 };
+ if (!hp->h265_pic_info.sliceSegmentCount)
+ return 0;
+
if (!dec->session_params) {
const HEVCSPS *sps = h->ps.sps;
const HEVCPPS *pps = h->ps.pps;