diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2022-10-22 05:29:35 +0000 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2022-11-21 23:57:03 +0800 |
commit | b7a3f169578cb6c8281afe33dd879df7d1029d6c (patch) | |
tree | a061b0e575fc3becb2fe9767837e0ea7422c60a5 | |
parent | 0ff18a7d6d496f89d9e007ddd1cad7116baf5c7c (diff) | |
download | ffmpeg-b7a3f169578cb6c8281afe33dd879df7d1029d6c.tar.gz |
avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r-- | libavutil/hwcontext.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index ab9ad3703e..3396598269 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -397,10 +397,14 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref, static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags) { - AVHWFramesContext *ctx = (AVHWFramesContext*)src->hw_frames_ctx->data; + AVHWFramesContext *ctx; AVFrame *frame_tmp; int ret = 0; + if (!src->hw_frames_ctx) + return AVERROR(EINVAL); + ctx = (AVHWFramesContext*)src->hw_frames_ctx->data; + frame_tmp = av_frame_alloc(); if (!frame_tmp) return AVERROR(ENOMEM); |