[FFmpeg-cvslog] vulkan_decode: reject decoding of frames with no slices
Lynne
git at videolan.org
Thu Jun 22 19:22:51 EEST 2023
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Thu Jun 22 04:59:40 2023 +0200| [997d8a7e73a9b9f00e4bc32ed3b41b30d2e39cf8] | committer: Lynne
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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=997d8a7e73a9b9f00e4bc32ed3b41b30d2e39cf8
---
libavcodec/vulkan_av1.c | 3 +++
libavcodec/vulkan_h264.c | 3 +++
libavcodec/vulkan_hevc.c | 3 +++
3 files changed, 9 insertions(+)
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;
More information about the ffmpeg-cvslog
mailing list