aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeandro Santiago <leandrosansilva@gmail.com>2024-10-31 21:50:45 +0100
committerZhao Zhili <zhilizhao@tencent.com>2024-11-06 16:34:02 +0800
commitfd0cacc4720c68c58f86e41153444252dbd4e5b6 (patch)
treed6ff49e077581010ed9cf8d7e1b9b97dce5d613d
parent7b20985d8d886fb32badc94f8d210bb596b19c2d (diff)
downloadffmpeg-fd0cacc4720c68c58f86e41153444252dbd4e5b6.tar.gz
fftools/ffplay: fix crash when vk renderer is null
When vulkan rendering is requested by the user and fails, ffplay should exit graciously instead of crash due to a null pointer deref. Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r--fftools/ffplay.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index a596972769..2a572fc3aa 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2612,6 +2612,11 @@ static int create_hwaccel(AVBufferRef **device_ctx)
if (type == AV_HWDEVICE_TYPE_NONE)
return AVERROR(ENOTSUP);
+ if (!vk_renderer) {
+ av_log(NULL, AV_LOG_ERROR, "Vulkan renderer is not available\n");
+ return AVERROR(ENOTSUP);
+ }
+
ret = vk_renderer_get_hw_dev(vk_renderer, &vk_dev);
if (ret < 0)
return ret;