[FFmpeg-devel] [PATCH 2/3] hwcontext_vaapi: Return error if can not find a VA RT format
Haihao Xiang
haihao.xiang at intel.com
Fri May 4 17:41:06 EEST 2018
Otherwise va_rt_format might be unitialized
Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
---
libavutil/hwcontext_vaapi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 7daaa951cc..e59042487d 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1028,6 +1028,11 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
va_rt_format = vaapi_format_map[i].rt_format;
}
+ if (i >= FF_ARRAY_ELEMS(vaapi_format_map)) {
+ av_log(dst_fc, AV_LOG_ERROR, "No matching VA RT format \n");
+ return AVERROR(EINVAL);
+ }
+
buffer_handle = desc->objects[0].fd;
buffer_desc.pixel_format = va_fourcc;
buffer_desc.width = src_fc->width;
--
2.17.0
More information about the ffmpeg-devel
mailing list